简体   繁体   中英

Having trouble with <hr> in CSS

When I use this code it displays the circle dots like I want it to. But that only happens in chrome, when I view the website on safari it is square. Is there any way to make it so it displays the same on both safari and chrome?

I tried it in chrome and it works perfectly, but on safari it is squares.

 hr { border-style: none; border-top-style: dotted; border-color:green; border-width: 10px; width:30%; } 
 <hr> 

Try this:

 hr { border-top: 10px dotted green; width: 30%; height: 0.01px; border-top-style: dotted; border-left: none; border-right: none; border-bottom: none; color: green; display: block; border-color: green; } 
 <hr> 

You can use Pseudo: after element to set dotted line after the text.Here is the example.

div {
  display: flex;
  width: 300px;
}

div:after {
  border-bottom: 1px dotted black;
  content: '';
  flex: 1;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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