<分区>
文字后面的线条可以只用CSS实现吗?
<分区>
文字后面的线条可以只用CSS实现吗?
最佳答案
是的。
HTML:
<h2><span>Centered Header Text</span></h2>
CSS:
body {
background: #ccc;
}
h2 {
text-align: center;
display: table;
width: 100%;
}
h2 > span, h2:before, h2:after {
display: table-cell;
}
h2:before, h2:after {
background: url(http://dummyimage.com/2x1/f0f/fff&text=+) repeat-x center;
width: 50%;
content: ' ';
}
h2 > span {
white-space: nowrap;
padding: 0 9px;
}
关于html - 这可以用 CSS 实现吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16800950/