📜  中间有图标的水平线的 CSS 技术 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:45.337000             🧑  作者: Mango

代码示例1

Heading

This is a longer heading

h1 { overflow: hidden; text-align: center; } h1:before, h1:after { background-color: #000; content: ""; display: inline-block; height: 1px; position: relative; vertical-align: middle; width: 50%; } h1:before { right: 0.5em; margin-left: -50%; } h1:after { left: 0.5em; margin-right: -50%; }