#CSS3 Border Radius Tutorial
Effective use of border-radius on some elements can remove the harshness of the square corners on some components.
Circle Element
In this example we’ll be creating a completely round circle object using nothing but css3. This is what our finished item will look like:
Source Code
To get this to work, what I’ve done is create a div and attached the .circle
class to that div. I’ve then defined this .circle within my css file and given
it a height and width of 100px. I’ve then added border-radius:100%; to this
class which gives it the shape of a perfect circle.
<div class="circle"></div>
<style>
.circle {
width: 100px;
height: 100px;
border-radius: 50px;
background-color: #074e68;
margin: auto;
}
</style>
Circle Images
It’s important to note that the border-radius: 100%; property can be attached
to <img> tags in order for them to take on a circular shape:

Source Code:
<img
class="circle"
src="https://s3.eu-west-1.amazonaws.com/images.tutorialedge.net/authors/profile.jpeg"
alt="circle-image"
/>
<style>
img.circle {
width: 100px;
height: 100px;
border-radius: 100%;
margin: auto;
}
</style>
border-radius For Specific Corners
There are times where you don’t want every corner of your object to be rounded, thankfully we can utilize some of the more specific border-radius properties in order to allow us to only round certain corners. We can do this by setting the 4 specific properties:
border-top-left-radius: 5px;
border-top-right-radius: 10px;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 30px;
or we can pass in 4 distinct parameters to our border-radius property like so:
border-radius: 10px 15px 20px 30px;
<div class="element"></div>
<style>
.element {
width: 100px;
height: 100px;
border-top-left-radius: 5px;
border-top-right-radius: 10px;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 30px;
background-color: #074e68;
margin: auto;
}
</style>
Output
Continue Learning
The Difference Between Class Selectors and ID Selectors in CSS
In this tutorial we take a look at the exact differences between class selectors and id selectors in CSS
How To Work With CSS3 Variables
In this tutorial we look at how we can get started working with CSS3 variables
CSS3 Box Shadow Tutorial
In this tutorial we look at how we can implement a css3 box shadow to components of our website.
Equal Height Columns in a Row using Flex Box
In this tutorial we'll be taking a look at how we can easily create equal height columns using CSS and HTML and a new feature of CSS, the Flex Box.