Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Circle with border

Tags:

css

css-shapes

Every guide I find has the line and fill the same colour. All I want is a circle with a red line and white fill.

I have tried:

.circle {     border: red;     background-color: #FFFFFF;     height: 100px;     -moz-border-radius:75px;     -webkit-border-radius: 75px;     width: 100px; } 

But cannot get the red border?

like image 908
Stre Avatar asked Oct 22 '15 09:10

Stre


People also ask

Can I use CSS border-radius?

You can give any element “rounded corners” by applying a border-radius through CSS. You'll only notice if there is a color change involved. For instance, if the element has a background-color or border that is different than the element it's above.

How do I make an image border round in CSS?

Style your corners. The border-radius CSS property is what adds the rounded corners. You can experiment with different values to get it the way you like. border-radius: 75px; If you want it to be a circle, add border-radius: 50%; .


1 Answers

You forgot to set the width of the border! Change border: red; to border:1px solid red;

Here the full code to get the circle:

.circle {      background-color:#fff;      border:1px solid red;          height:100px;      border-radius:50%;      -moz-border-radius:50%;      -webkit-border-radius:50%;      width:100px;  }
<div class="circle"></div>
like image 182
Sebastian Brosch Avatar answered Sep 19 '22 15:09

Sebastian Brosch