Pakistan's Educational, Test Preparation & Career Portal
LearningHints
Web Designing

How we Round The Corner Of Box in HTML

By Tauqeer Shah Published: 14 Apr 2014

Round Corner Box in HTML

How we Round The Corner Of Box in HTML

This tutorial will guide you that how you can round you box or table or DIV corner using simple HTML and CSS for formatting. Read the Following steps and Copy and past in your own web page source file. Now We are going to create a Div and Then we round The corner of that div.

First i am going to write simple code


<!-- Simple Box with rounded corners and shadow -->
<div class="rounddiv divshadow" style="width: 600px; border: solid 2px red"> 
<div class="contents">
This is Rounded Corner DIV.
</div>
</div>

In above cod we create a Div with 600px width and red border and we round the corner of This div. Next div is just for our Contents.

Now Create a CSS file and Copy The following Code:


.divshadow
{
-moz-box-shadow: 3px 3px 5px #535353;
-webkit-box-shadow: 3px 3px 5px #535353;
box-shadow: 3px 3px 5px #535353;
}
.rounddiv
{
-moz-border-radius: 6px 6px 6px 6px;
-webkit-border-radius: 6px;
border-radius: 6px 6px 6px 6px;
}

in Above Code box-shadow attributes specify the the horizontal and vertical offset of the shadow and blur distance and a shadow color. box-radius set the top-left-radius top-right-radius bottom-right-radius bottom-left-radius. border-radius takes a pixel size for the radius for each corner going clockwise.

-moz-box-shadow and -webkit-box-shadow are browser specific code which is prefixes for FireFox and Chrome/Safari respectively.