Languages
[Edit]
EN

CSS - circle div

3 points
Created by:
nickkk0
647

In this article, we would like to show you how to make circle div in CSS.

Quick solution:

.circle{
    border-radius: 50%;
}

Simple circle element

To make a simple circle element we need to create a style with border-radius property set to 50% and attach it to our <div> element.

Runnable example:

// ONLINE-RUNNER:browser;

<html>
<head>
  <style>

    .circle1 {
        background: red;
        border-radius: 50%; /* <-------- required */
        width: 50px;
        height: 50px;
        display: inline-block;
    }

  </style>
</head>
<body>
  <div class="circle1"></div>
</body>
</html>

Circle elements with border

In below example, once again we use border-radius property set to 50% to make our elements round. Then we use various border properties to style our circles.

Runnable example:

// ONLINE-RUNNER:browser;

<html>
<head>
  <style>

    .circle2 {
        background: yellow;
        border-radius: 50%; /* <-------- required */
        border: solid;
        border-color: red;
        width: 60px;
        height: 60px;
        display: inline-block;
    }

    .circle3 {
        background: lightgreen;
        border-radius: 50%; /* <-------- required */
        border: double;
        border-color: blue;
        border-width: 8px;
        width: 70px;
        height: 70px;
        display: inline-block;
    }

  </style>
</head>
<body>
  <div class="circle2"></div>
  <div class="circle3"></div>
</body>
</html>

Note:
Here you can find more informations about CSS border property.

Alternative titles

  1. HTML / CSS - how to make circle div
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

HTML

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join