简体   繁体   English

Chrome不显示伪元素

[英]Chrome does not display pseudo-element

i have a problem,my code doesn't work on Chrome but is work fine in Firefox.Chrome does not show pseudo element probably like Firefox does.Here is a piece of my code.Please help and just ignore my bad English.Thank you. 我有一个问题,我的代码无法在Chrome上正常运行,但在Firefox上可以正常工作。Chrome不会像Firefox一样显示伪元素。这是我的一部分代码。请帮助,请忽略我的英语不好。谢谢。 Codepen 码笔

<hr class="graph__coordinate-line">
<hr class="graph__coordinate-line">
<hr class="graph__coordinate-line">
<hr class="graph__coordinate-line">
<hr class="graph__coordinate-line">
<hr class="graph__coordinate-line">
<hr class="graph__coordinate-line">
<hr class="graph__coordinate-line">

Its because chrome applies the overflow:hidden to the <hr> element by default in user agent stylesheet. 这是因为chrome在用户代理样式表中默认将overflow:hidden应用于<hr>元素。 So you will need to apply overflow:visible to the <hr> element. 因此,您将需要对<hr>元素应用overflow:visible

在此处输入图片说明

 body { padding-top: 10rem; padding-left: 1rem; counter-reset: line 7; } hr { overflow: visible; } .graph__coordinate-line { border: 1px dashed #ccc; position: relative; width: calc(100% - 5rem); font-size: 1.3rem; } .graph__coordinate-line:not(:last-of-type) { margin-bottom: 2rem; counter-increment: line -1; } .graph__coordinate-line:not(:last-of-type)::after { content: " " counter(line) " K "; position: absolute; top: -1.5rem; left: -3.2rem; } .graph__coordinate-line:last-of-type::after { content: "0"; position: absolute; top: -1.5rem; left: -3.2rem; } .graph__coordinate-line::before { content: "\\2013"; position: absolute; top: -1.5rem; left: -5rem; } 
 <hr class="graph__coordinate-line"> <hr class="graph__coordinate-line"> <hr class="graph__coordinate-line"> <hr class="graph__coordinate-line"> <hr class="graph__coordinate-line"> <hr class="graph__coordinate-line"> <hr class="graph__coordinate-line"> <hr class="graph__coordinate-line"> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM