如何在css的标题的两边放置实线? [英] How can I put solid lines on either side of a header with css?
问题描述
在某个页面上,我的客户希望我小部件与线从标题的任一侧脱落。有一个简单的方法,我可以使这些红色标题只用css?
底部,然后在包含文本的标题中有< span>
,在span上放置一个白色的背景颜色,并将其向下移动几个像素覆盖部分边框
position:relative;
bottom:-10px;
编辑:您需要设置 text-align:中心;
,并确保其上没有 overflow:hidden;
! $ b
Possible Duplicate:
How can I make a fieldset legend-style “background line” on heading text?
On a certain page my client wants me to make a small widget with lines coming off of either side of the headers. Is there a simple way I can make these red headers with just css?
Off the top of my head and untested... You could put a border bottom on the header, then have a <span>
inside the header which contains the text, put a background colour of white on the span and move it down a few pixels to cover up part of the border
position: relative;
bottom: -10px;
Edit: You would need to set a text-align: center;
on the header, and ensure it does not have an overflow: hidden;
on it!
这篇关于如何在css的标题的两边放置实线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!