Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create doughnut shape in CSS [duplicate]

Tags:

I know how to create a css circle with border radius etc, but i'm interested in creating a css only doughnut shape roughly like this one here -> enter image description here

It would be one div but curved round back onto itself,

any ideas??

like image 268
benhowdle89 Avatar asked Dec 12 '11 01:12

benhowdle89


2 Answers

<div class="doughnut"></div>


.doughnut { 
    border: 50px solid #f00;
    border-radius: 100px;
    height:100px;
    width:100px;
}
like image 91
Seth Avatar answered Sep 20 '22 13:09

Seth


This shape can also be drawn with css3 radial-gradient():

div {
  background: radial-gradient(circle, transparent 40%, purple 40%);
}

body {
  background: linear-gradient(orange, red) no-repeat;
  min-height: 100vh;
  margin: 0;
}

div {
  background: radial-gradient(circle, transparent 40%, purple 40%);
  border-radius: 100%;
  height: 300px;
  width: 300px;
  margin: 25px;
}
<div></div>
like image 21
Mohammad Usman Avatar answered Sep 17 '22 13:09

Mohammad Usman