<分区>
<分区>
我已经阅读了多个线程但没有成功。
我正在寻求有关在 CSS 中在文本旁边创建一行的帮助。我不允许更改 HTML 代码,因此向 html 代码添加 span 元素对我来说不是解决方案。
这是它的样子。
<legend>Text</legend>
我想创建这样一行 http://imgur.com/BVQ2txt
在不更改 html 代码的情况下有什么解决方案吗?
最佳答案
你可以这样做:
legend { height: 18px; position: relative; background: #fff; display: inline-bock; margin-left: 5px; }
legend:before { content: ""; display: block; font-size: 0; line-height: 0; text-indent: -4000px; position: absolute; top: 8px; left: -5px; right: -100px; height: 1px; border-top: 1px solid red; z-index: -1; }
关于html - CSS,在文本旁边创建一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33282439/