右侧的水平规则与桌面和移动设备上Safari中的文本重叠
如何防止重叠?
http://codepen.io/simply-simpy/pen/EyENLr
h2 {
align-items: center;
display: flex;
font-size: 3.125vw;
margin-top: 0;
position: relative;
width: 100%;
}
h2:after {
border-top: 1px solid #000;
content: "";
display: block;
margin-left: 1.875vw;
width: 100%;
}
h2:before {
border-top: 1px solid #000;
content: "";
display: block;
margin-right: 1.875vw;
width: 100%;
}
.container {
align-items: center;
align-content: center;
text-align: center;
display: flex;
flex-direction: column;
}
<div class="container">
<h2>precision</h2>
</div>
答案 0 :(得分:1)
在flex-grow: 1;
和width: 100%;
上使用h2:before
代替h2:after
即可解决问题。
h2 {
align-items: center;
display: flex;
font-size: 3.125vw;
margin-top: 0;
position: relative;
width: 100%;
}
h2:after {
border-top: 1px solid #000;
content: "";
display: block;
margin-left: 1.875vw;
flex-grow: 1; /* <--- Replace */
}
h2:before {
border-top: 1px solid #000;
content: "";
display: block;
margin-right: 1.875vw;
flex-grow: 1; /* <--- Replace */
}
.container {
align-items: center;
align-content: center;
text-align: center;
display: flex;
flex-direction: column;
}
&#13;
<div class="container">
<h2>precision</h2>
</div>
&#13;