Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border Radius only rounding the top of a div?

Tags:

html

css

Applying border-radius property on a div with a border only applies it to the top corners. Why is that?

Example:

https://jsfiddle.net/07tqbo56/1/

.asd {
  margin-top: 35px; 
  width: 123px;
  border-top-style: solid; 
  border-top-color: #1163b9; 
  border-top-width: 70px; 
  border-radius: 70px;
}
<div class="asd"></div>

enter image description here

This is how it looks like on Firefox 72, Ubuntu 19.

like image 747
user3761308 Avatar asked Dec 15 '25 04:12

user3761308


2 Answers

This is happening because your other border properties are only being applied to the top border, for example, border-top-style needs to be just border-style.

When only one border is solid, some browsers apply border-radius to just that border, while others still apply it to all borders.

.asd {
  margin-top: 35px; 
  width: 123px;
  border-style: solid; 
  border-color: #1163b9; 
  border-width: 70px; 
  border-radius: 70px;
}
<div class="asd"></div>
like image 118
Run_Script Avatar answered Dec 16 '25 19:12

Run_Script


Not only in FireFox, it will look like that in all browsers,

Are you trying to do like this?

Just deleted the "Top" in border-style, -color and -width. "Top" will do the changes only on the top of the design.

.asd {
  margin: 35px; 
  width: 123px;
  border-style: solid; 
  border-color: #1163b9; 
  border-width: 70px; 
  border-radius: 70px;
}
<div class="asd"></div>

I hope this would have solved your problem.

like image 22
S14321K Avatar answered Dec 16 '25 18:12

S14321K



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!