Files
30-seconds-of-code/snippets/circle.md
Angelos Chalaris d2c10f3e65 Deprecate browser support
Bump integration tools to 2.1.0
2020-04-29 13:47:57 +03:00

456 B

title, tags
title tags
Circle visual,beginner

Creates a circle shape with pure CSS.

<div class="circle"></div>
.circle {
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  background: #333;
}

Explanation

  • border-radius: 50% curves the borders of an element to create a circle.
  • Since a circle has the same radius at any given point, the width and height must be the same. Differing values will create an ellipse.