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

Shapes are everywhere in web design. Squares and rectangles are the most common because they maximize infinite on the rectangular devices they're displayed on (desktops, tablets, mobile devices, even smart swatches). Just if you desire to make your website stand out and catch the visitor's heart, y'all tin can try using circles. Hither's a ridiculously cool example of a circular design:

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

Image Source

At present that nosotros understand some of the benefits of incorporating circles into your website's blueprint, permit's walk through how to create a circle, circular div container, and oval using CSS.

Download Now: Free Intro Guide to HTML & CSS

Step ane: Add the HTML element.

Let'south say you desire to make an image into a perfect circle. In that case, you lot'd add an prototype element with an alt and source aspect in HTML.

Hither'southward an instance:

                                          
<img src="https://images.unsplash.com/photograph-1622322062536-895d869b09ff?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.two.1&auto=format&fit=ingather&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 stock-still and equal width and height. So set up the width and height to the same value in CSS.

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

The edge-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 edge-radius holding to 50%.

Here'southward the CSS and result:

Encounter 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 every bit above. Add a div in HTML. Then, set the width and pinnacle of the element to the same value. Finally, specify the value of the border-radius holding to l%.

Here'southward an instance:

Run into the Pen How to Create a Circumvolve Div Using Edge-Radius CSS by Christina Perricone (@hubspot) on CodePen.

Notice that I made the div a flex container and then I could identify text within the div and heart it using the align-items and justify-content properties.

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

How to Brand an Oval With a Border Radius in CSS

Making an oval is a near identical process to making a perfect circumvolve. You add together the HTML chemical element. Just instead of assigning it an equal width and height, set them to be different. Then, ready the CSS border-radius property to fifty%. The result is an oval.

Hither'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 assistance grab your company's eye and drag your design. The best part? It'southward easy to create circles using the CSS border-radius belongings. You just demand to know the basics of HTML and CSS to create this unique shape.

New Call-to-action

css introduction

Originally published Jun 4, 2021 seven:00:00 AM, updated Baronial 23 2021