简体   繁体   English

::在Chrome Mobile上没有出现伪元素之后

[英]::after pseudo-element not appearing on Chrome Mobile

Pretty simple but odd bug, I have a pseudo-element which is appearing fine on desktop browsers but disappears on mobile Chrome (not sure about iOS, no iPhone to test with) 非常简单但奇怪的错误,我有一个伪元素,在桌面浏览器上显得很好但在移动Chrome上消失(不确定iOS,没有iPhone测试)

Here's the basic CSS: 这是基本的CSS:

 a { text-decoration: none; display: inline-block; color: #000; overflow: visible; } a::after { content: ''; display: block; height: 8px; width: 98%; background: #8BC8F690; margin-top: -9px; margin-left: 2px; } 
 <a>hello</a> 

jsfiddle: https://jsfiddle.net/w4d1jteb/ jsfiddle: https ://jsfiddle.net/w4d1jteb/

Check your background . 检查你的background This is not a valid value. 这不是有效值。 It's 8 chars long, but only can have 6. 这是8个字符长,但只能有6个字符。

a {
  text-decoration: none;
  display: inline-block;
  color: #000;
  overflow: visible;
}

a::after {
  content: '';
  display: block;
  height: 8px;
  width: 98%;
  background: #8BC8F690; <-- This is not valid. *1*2
  margin-top: -9px;
  margin-left: 2px;
}

*1: You could try background-color: rgba(139, 200, 246, 0.565) instead. * 1:您可以尝试background-color: rgba(139, 200, 246, 0.565)

*2: Or just use #8BC8F6 . * 2:或者只使用#8BC8F6

See these examples below: 请参阅以下示例:

 a { text-decoration: none; display: inline-block; color: #000; overflow: visible; } a::after { content: ''; display: block; height: 8px; width: 98%; background-color: rgba(139, 200, 246, 0.565); margin-top: -9px; margin-left: 2px; } #test { text-decoration: none; display: inline-block; color: #000; overflow: visible; } #test::after { content: ''; display: block; height: 8px; width: 98%; background: #8BC8F6; margin-top: -9px; margin-left: 2px; } 
 <a>hello</a> <a id="test">hello2</a> 

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

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