Languages
[Edit]
EN

HTML - how to make circle div

3 points
Created by:
Dirask Community
3930

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

Quick solution:

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.

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