HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
PHP Tutorial

PHP forms
HTML Tutorial

CSS Tutorial

CSS rounded corners


In this article we will see how we can get rounded corner effect using border radius without going through the laborious process of creating images and fitting them in every item corner to create the desired effect.
We will instead use something that designers and developers have already begun to adopt with great joy in CSS.

CSS rounded corners - how to create - example


With CSS, you can give each element "rounded corners" using proprietary radius borders.

Here are three examples:
1. rounded corners for an item with a specified background color,
2. rounded corners for an element with a border,
3. rounded corners for an element with a background image.
Here is the code:

Example 1:

.corner-radius1
{
border-radius:12px;
padding:10px;
width:250px;
height:160px;
background-color: #FF9;
float: left;
}

.corner-radius2
{
border-radius:12px;
padding:10px;
width:250px;
height:160px;
border: thin solid #0C0;
float: left;
margin-left: 18px;
}

.corner-radius3
{
border-radius:12px;
padding:10px;
width:250px;
height:160px;
background-image: url(https://www.agernic.com/uploads/paper.gif);
float: left;
margin-left: 18px;
}

HTML cod above will display this result -

css border radius

Note: border-radius property is actually an abbreviation for border-top-left-radius, border-top-right-radius, border-bottom-right-radius and border-bottom-left-radius properties.

CSS border-radius - Specify each corner - How to create

If you specify a single border property radius value, this radius will be applied to all four corners.
However, you can specify each corner separately if you want. Here are the rules:

Four values: the first value is valid for the top left, the second value is applied from the top right, the third value is applied to the bottom right, and the fourth value is applied in the lower-left corner
Three values: the first value is valid for the top left, the second value is for the top-right and the lower-left, and the third value is applied to the bottom-right
There are two values: the first value is applied to the top left and right-hand corner, and the second value is applied from the top right and the lower-left corner
A single value: all four corners are rounded evenly
Here are three examples:
1. Four values ​​- border-radius:15px 50px 30px 5px:
2. three values ​​- border-radius:15px 50px 30px:
3. There are two values ​​- border-radius:15px 50px:

Example 2:
.corner-radius4 {
border-radius: 15px 50px 30px 5px;
padding:10px;
width:250px;
height:160px;
border: thin solid #0C0;
float: left;
margin-left: 18px;
}

.corner-radius5 {
border-radius: 15px 50px 30px;
background:#73AD21;
padding:10px;
width:250px;
height:160px;
border: thin solid #0C0;
float: left;
margin-left: 18px;
}

.corner-radius6 {
border-radius:15px 50px;
padding:10px;
width:250px;
height:160px;
border: thin solid #0C0;
float: left;
margin-left: 18px; 
}
The HTML cod above will display this result -

css border radius, css border radius without images CSS rounded corners - css tutorial

3180. CSS align image center - how to create, css tutorial
CSS align image center - how to create css tutorial
https://www.agernic.com/css-tutorial/css-align-image-center-how-to-create.html

3179. CSS align content Property - CSS align text - how to create, css tutorial
CSS align content Property - CSS align text - how to create css tutorial
https://www.agernic.com/css-tutorial/css-align-content-property-css-align-text-how-to-create.html

3011. CSS max width - max height - CSS responsive, css tutorial
CSS max width - max height - CSS responsive css tutorial
http://www.agernic.com/css-tutorial/css-max-width-max-height-css-responsive.html

813. CSS box model - CSS tutorials - w3resource

https://www.w3resource.com/css/concepts/box-model.php

823. CSS Text Align - CSS tutorials - w3resource

https://www.w3resource.com/css/text/text-align.php

818. CSS Font Families - CSS tutorials - w3resource

https://www.w3resource.com/css/fonts/font-families.php

Your add here
PHP strstr() function

PHP rtrim() function

PHP htmlentities() function

PHP htmlspecialchars_decode() function

PHP strcmp() function

PHP define() function

PHP implode() function

PHP ltrim() function

PHP empty() Function

PHP printf() function

PHP count() Function

PHP ucfirst() function

PHP strrchr() Function

PHP ucwords() function

PHP substr() function

PHP str_split() function

Login in PHP - simple login script with PHP MYSQL
PHP Variables
HTML comment one line and multiple lines
CSS Button Border
PHP While Loops. Tutorial While Loop
CSS Padding, top, bottom, left, right