How to make a div with a circular shape? [duplicate]


Tags: css,css-shapes

Problem :

This question already has an answer here:

i want to create a div with background color red and completely circular in shape

How can i do that?

Css or jquery both can be used



Solution :

Using jquery and css you can create circle. I am giving here a jquery solution, as CSS solution already provided by others. check jquery DEMO.

jQuery Code

$(document).ready(function()
{
  $("div").css("border-radius", "50%");
});

CSS Code

div
{
/*border-radius: 50%;*/
width: 50%;
height: auto;
padding-top: 50%;
background: #ef8913;
}

    CSS Howto..

    How to use CSS position(relative, absolute) with percentage (height, width) dimension? [closed]

    How does this drop-down have the ^ shown?

    How to avoid calling “fonts.googleapis.com/css?family=..” for my CSS files

    How to cut divs both ways to keep the objects in center?

    How to add a border to only percentage of width of element, CSS Trick

    How to style the tabs in primary menu links in a Drupal 7 subtheme?

    How to vary shade of specific table row id

    How do I use css to make a row of boxes that do not wrap when browser shrinks?

    How can I set a height, or allow a div to extend to the height of absolutely position elements within?

    How Do I Use Gulp to Minify and Autoprefix CSS files from SASS/SCSS

    How to display a long link in multiple lines via CSS?

    How to write specific CSS for mozilla, chrome and IE

    How to regex rotate properties from transform value

    How to position a scroll box on top of an image using only inline CSS

    css only. Click on li, show nested ul and li. Release mouse button, must continue show nested ul and li

    How to crop an image edge

    CSS Shadows (how to get rid of top shadow?)

    when click on button then show message

    How to make css width work in firefox

    how to align divs with different width within another parent div?

    How do I remove applied css on a div by JQuery?

    Spring, Prime Faces application not showing CSS when deploying to Heroku

    How do you create and run an html page directly from LocalStorage?

    How to have JavaScript read a value appended with CSS at a given ID

    How do I set the width of inputs within a column in Twitter Bootstrap's grid system?

    How can I insert dynamic text into a div with absolute position?

    How to correctly override default JavaFX 8 CSS on TableView

    How do I enlarge images on a web page

    How to set the CSS class name dynamically in LessCSS?

    How to assign a css class to echo $output