What the person above said is correct. I would like to add a little point here: use p pseudo-elements: before and :after, and then absolutely position them on both sides. IE7 and below are not compatible. If you need to be compatible with lower versions of IE, then Need to think about it again.
The short lines on the left and right sides can be realized by using the left border of p, and the color of the border can be achieved by using the linear gradient of CSS3 linear-gradient, but it is not backward compatible.
But in fact, it is better to add <p class="蓝色"></p> directly to border. Multiple ps are not a problem and the compatibility is better.
If it is not compatible with lower versions of IE, you can use :after, :before to control the display of the left and right borders. If it is compatible, it will be like the one above, but the blank space is meaningless. Too much
Go directly to the answer, one
<p>
can do it:http://jsfiddle.net/2drzmzkh/
uses a pseudo element
::before
.Use two pseudo-elements for absolute positioning. .
What the person above said is correct. I would like to add a little point here: use p pseudo-elements: before and :after, and then absolutely position them on both sides. IE7 and below are not compatible. If you need to be compatible with lower versions of IE, then Need to think about it again.
The short lines on the left and right sides can be realized by using the left border of p, and the color of the border can be achieved by using the linear gradient of CSS3
linear-gradient
, but it is not backward compatible.But in fact, it is better to add
<p class="蓝色"></p>
directly toborder
. Multiple ps are not a problem and the compatibility is better.If it is not compatible with lower versions of IE, you can use :after, :before to control the display of the left and right borders. If it is compatible, it will be like the one above, but the blank space is meaningless. Too much
border-left,border-right
Don’t a box have a border, and then the top border is removed?