How to Draw a Circle Using the CSS Border Radius Property

Free Checklist: How to Land a Developer Role
Anna Fitzgerald
Anna Fitzgerald

Updated:

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: How to Land a Developer Role in  the World of AI [Free Checklist]

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.

How To Land a Developer Role in the World of AI

A free checklist to you help you stand out from the competition featuring Software Developer and YouTube Creator Tech With Tim.

  • Expert advice on how to build a portfolio
  • Top programming languages to learn
  • Resume building and interview tips
  • Resources to strengthen communication skills

    Download Free

    All fields are required.

    You're all set!

    Click this link to access this resource at any time.

    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.

    How To Land a Developer Role in the World of AI

    A free checklist to you help you stand out from the competition featuring Software Developer and YouTube Creator Tech With Tim.

    • Expert advice on how to build a portfolio
    • Top programming languages to learn
    • Resume building and interview tips
    • Resources to strengthen communication skills

      Download Free

      All fields are required.

      You're all set!

      Click this link to access this resource at any time.

      Related Articles

      A free checklist to help you stand out from human and AI competition and land a developer job.

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

        START FREE OR GET A DEMO