gpt4 book ai didi

html - 伪元素在 Internet Explorer 上的 hr 标记中无法正常工作之后

转载 作者:太空宇宙 更新时间:2023-11-04 14:13:53 25 4
gpt4 key购买 nike

以下代码适用于除 Internet Explorer 之外的所有浏览器。在 IE 中,措辞似乎被压缩到 1px height 或被 hr 渐变覆盖。是什么导致了这个问题?

.hr-how {
text-align: center;
border: 0;
height: 1px;
margin-bottom: 40px;
margin-top: 40px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}
.hr-how:after {
content: "HOW TO USE IT";
display: inline-block;
position: relative;
top: -0.7em;
font-size: 0.9em;
padding: 0 0.6em;
background: white;
}
<hr class="hr-how" id="hr-how">

http://jsfiddle.net/y8nx51rf/

最佳答案

发生这种情况是因为 hr 标签上 overflow 的默认设置在 Chrome 和 Firefox 中是 visiblehidden 在 IE 中。这会导致 hrheight 之外的任何内容在 IE 中被截断。

要使其在 IE 中正常工作,请将 overflow: visible; 添加到 .hr-how 以便文本可以扩展到 hr 的边界之外>.

.hr-how {
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
border: 0;
height: 1px;
margin-bottom: 40px;
margin-top: 40px;
overflow: visible;
text-align: center;
}
.hr-how:after {
background: white;
content: "HOW TO USE IT";
display: inline-block;
font: "BodoniXT" !important;
font-size: 0.9em;
padding: 0 0.6em;
position: relative;
top: -0.7em;
}
<hr class="hr-how" id="hr-how" />

关于html - 伪元素在 Internet Explorer 上的 hr 标记中无法正常工作之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33144108/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com