How to Draw a Circle Using the CSS Border Radius Property

Download Now: Free HTML & CSS Coding Templates
Anna Fitzgerald
Anna Fitzgerald

Published:

When looking through a few of your favorite websites, what do you notice first? Maybe the images first, then the colors and typography. What about shapes?

Developers creating circles using the CSS border radius property for their website

Download Now: 50 Code Templates [Free Snippets]

Shapes are everywhere in web design. Squares and rectangles are the most common because they maximize space on the rectangular devices they’re displayed on (desktops, tablets, mobile devices, even smart swatches). But if you want to make your website stand out and catch the visitor’s eye, you can try using circles. Here’s a ridiculously cool example of a circular design:

Website design with video clips in circle to look like a record

Image Source

Now that we understand some of the benefits of incorporating circles into your website’s design, let’s walk through how to create a circle, circular div container, and oval using CSS.

We're committed to your privacy. HubSpot uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.

We're committed to your privacy. HubSpot uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.

50 Free Coding Templates

Free code snippet templates for HTML, CSS, and JavaScript -- Plus access to GitHub.

  • Navigation Menus & Breadcrumbs Templates
  • Button Transition Templates
  • CSS Effects Templates
  • And more!
Loading your download form

You're all set!

Click this link to access this resource at any time.

Access now
Learn more

Step 1: Add the HTML element.

Let’s say you want to make an image into a perfect circle. In that case, you’d add an image element with an alt and source attribute in HTML.

Here’s an example:

<img src="https://images.unsplash.com/photo-1622322062536-895d869b09ff?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1500&q=80" alt="distressed Italian wall in pink and grey hues">

Step 2: Assign it an equal width and height.

To make an element into a perfect circle, it must have a fixed and equal width and height. So set the width and height to the same value in CSS.

Step 3: Set the CSS border-radius property to 50%.

The border-radius property can be used to create rectangles with rounded edges, ellipses, and other shapes — including a perfect circle. To create a perfect circle, specify the value of the border-radius property to 50%.

Here’s the CSS and result:

See the Pen Ellipsis by Christina Perricone (@hubspot) on CodePen.

How to Create a Circle Div Using Border-Radius CSS

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%.

Here’s an example:

See the Pen How to Create a Circle Div Using Border-Radius CSS by Christina Perricone (@hubspot) on CodePen.

Notice that I made the div a flex container so I could place text within the div and center it using the align-items and justify-content properties.

To learn more about this process, check out 11 Ways to Center Div or Text in Div in CSS.

How to Make an Oval With a Border Radius in CSS

Making an oval is a nearly identical process to making a perfect circle. You add the HTML element. But instead of assigning it an equal width and height, set them to be different. Then, set the CSS border-radius property to 50%. The result is an oval.

Here’s an example:

See the Pen How to Make an Oval With a Border Radius in CSS by Christina Perricone (@hubspot) on CodePen.

Drawing Circles in CSS

Creating and adding circles to your website or app can help catch your visitor’s eye and elevate your design. The best part? It’s easy to create circles using the CSS border-radius property. You just need to know the basics of HTML and CSS to create this unique shape.

New Call-to-action

Related Articles

We're committed to your privacy. HubSpot uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.

Dozens of free coding templates you can start using right now

CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience

START FREE OR GET A DEMO