Cross Browser Round Corners
This is the best method I've found for creating rounded corner boxes for my page layout. It doesn't care what browser you are using and requires no javascript. It is 100% CSS.
First of all you will need 4 images for your four corners. Because your box needs to be able to resize with the browser window the images need to be more than half the width of the max size your box will ever be. i.e. if the max size of your box will be 800 px. then the images need to be about 420 px. The images I've used here are 400 px.
Here are the images I've used on some of my pages...




Note that the images are 8px. high and are a background color with a 1 px border that is used to make the round corner. Remember the 8px height because there is a tweak later that uses that value.
Next step is to create the CSS that forms our box. Basically there are 7 elements that make up our box. There is a parent container for the top and bottom and two nested containers / divs for each that hold our images as background-images. The parent containers have some margins set here but they are adjustable depending on your use. Also remember to use the correct path for your background image. Mine are in a folder named "corners".
.top
{
width:750px;
height:8px;
margin-top:30px;
margin-left:auto;
margin-right:auto;
}
.topL
{
background-image:url("corners/topL.gif");
background-position:left top;
background-repeat:no-repeat;
height:8px;
min-height:8px;
line-height:2px;
}
.topR
{
background-image:url("corners/topR.gif");
background-position:right top;
background-repeat:no-repeat;
height:8px;
min-height:8px;
margin-top:-8px;
line-height:2px;
}
.bottom
{
width:750px;
height:8px;
margin-bottom:25px;
margin-left:auto;
margin-right:auto;
}
.bottomL
{
background-image:url("corners/bottomL.gif");
background-position:left bottom;
background-repeat:no-repeat;
height:8px;
min-height:8px;
line-height:2px;
}
.bottomR
{
background-image:url("corners/bottomR.gif");
background-position:right bottom;
background-repeat:no-repeat;
height:8px;
min-height:8px;
margin-top:-8px;
line-height:2px;
}
.container
{
width:725px;
max-width:725px;
margin-left:auto;
margin-right:auto;
padding:12px 12px 15px 12px;
background-color:#fcfcfc;
border-left:solid 1px #666666;
border-right:solid 1px #666666;
text-align:center;
} Note the two containers "topL" and "topR"; a margin-top value of "-8" is set for the "topR" div. This will cause the "topR" div to sit on top of the "topL" div. Also note the "line-height" value of 2px. This seemingly useless attribute is required to make this behave correctly.
OK, the bottom is just the same as the top except you use the "bottomL" and "bottomR" images.
The final step is the actual content container. The content container's background should match the background color of the images. And the content container should have a left and right border.
Finally when you put this together on the page it will look something like this.
<divclass="top">
<divclass="topL"></div>
<divclass="topR"></div>
</div>
<divclass="container">
All your content goes here
</div>
<divclass="bottom">
<divclass="bottomL"></div>
<divclass="bottomR"></div>
</div>
Need Hosting with serious speed and power? 3.99 a month. Take a look here. Serious Website Hosting.
Need Hosting with serious speed and power? 3.99 a month. Take a look here. Serious Website Hosting.