我正在尝试寻找创造性的方法来制作页眉,因为在我看来,典型的方法很无聊。
这是我发现的:
这两个分开的<hr />
元素是<span class="glyphicon glyphicon-star></span>
中间的吗?
我已经尝试过,但无法弄清楚如何做到这一点,以便它是动态的。如果 css<h1>
比 About 长(在图片中),我不想调整 css 。
这是我所拥有的:
HTML:
<div class="container">
<h1 class="text-center">About</h1>
<hr class="new-hr" />
<span class="glyphicon glyphicon-star"></span>
<hr class="new-hr"/>
</div>
CSS:
.new-hr{
width: 20%
}
我还创建了一个codepen。
有人可以帮我重新创建这个吗?
任何帮助表示赞赏。
这个怎么样:
放置div
带有底部边框的 a,并将包含星形的跨度设置为 position:relative 并将其向下移动到 div 上。
body {background: #fff;}
.underline {
width: 100%;
border-bottom: 4px solid #000;
text-align: center;
position: relative;
}
.underline span {
position: relative;
top: 15px;
padding: 0 10px;
background: #fff;
font-size:25px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="underline">
<span>
<i class="fa fa-star" aria-hidden="true"></i>
</span>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句