Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create this shape with only divs and css

the shape you need to create using only divs and CSS

I have this shape as a PNG that I would like to create it with CSS so that I can dynamically change the fill color.

My question is: How can I most effectively recreate this image using only divs and CSS?

Note that there is a 5px white stroke around the orange fill. That stroke needs to be created as well. And the area to the right of the curve on the right needs to be transparent. Your CSS can not use external assets such as background images.

Ideally the CSS would work in the majority of browsers including IE 7, 8 and 9. But that's not absolutely required.

Go forth you CSS wizards and show me your darkest dirtiest CSS secrets. I will be putting a bounty of 50 on this as soon as the site allows me, and will award that fully to the best answer, regardless of when you submit you answer.

Let's see what you've got.

like image 530
Rafe Avatar asked Nov 17 '12 15:11

Rafe


People also ask

How do I make a div look like a circle?

To create a circular div in CSS, follow the same steps as above. Add a div in HTML. Then, set the width and height of the element to the same value. Finally, specify the value of the border-radius property to 50%.

How do I create a polygon shape in CSS?

The polygon() function is an inbuilt function in CSS which is used with the filter property to create a polygon of images or text. Syntax: polygon( percentage | length); Parameter: This function accepts two parameter percentage or length which is used to hold the value of polygon size.

Can you create a circle using CSS?

To create a circle we can set the border-radius on the element. This will create curved corners on the element. If we set it to 50% it will create a circle. If you set a different width and height we will get an oval instead.


1 Answers

HTML

<div id="css"></div>​

CSS

#css {
  width: 118px;
  height: 74px;
  margin: 20px 20px;
  background: red;
  border: 6px solid white;
  border-radius: 20% / 62%;
  border-top-left-radius: 6px; 
  border-bottom-left-radius: 6px; 
}

Live example

I dare you to guess which one is which without looking at the HTML ;)

like image 131
jacktheripper Avatar answered Sep 20 '22 19:09

jacktheripper