CSS Rounded Corners and Shadows

Adding rounded corners with borders and shadows has gotten easier than ever with CSS.
You can add them to images or just about anything.

A box with rounded corners and some color can be a great way to spice up a pages Look and Feel on any site. Checkout the samples below.

This is a box with rounded borders. Enter any text you like to highlight or add emphasis to something on your pages.



The CSS code:

#roundedbox {
padding: 5px;
width: 310px;
background-color:#d9d9d9;
border-width:1px;
border-style:solid;
border-color:#000;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}

The HTML Code:

<div id=”roundedbox”>
This is a box with rounded borders. Enter any text you like to highlight or add emphasis to something on your pages.
</div>


Now we can take the same box and add a different background color and some shadow effect to it as well. The shadow really brings out the box and makes it standout on the page.


This is a box with rounded borders. Enter any text you like to highlight or add emphasis to something on your pages.



The CSS code for rounded box with Shadows:

#roundedbox-shadow {
padding: 5px;
background-color: #C7E9F9;
-moz-box-shadow:3.5px 3.5px 5px #000000;
-webkit-box-shadow:3.5px 3.5px 5px #000000;
box-shadow:3.5px 3.5px 5px #000000;
border-width:1px;
border-style:solid;
border-color:#000;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;

The HTML code for the rounded box with shadow effect:

<div id=”roundedbox-shadow”>
This is a box with rounded borders. Enter any text you like to highlight or add emphasis to something on your pages.
</div>

We can add the same effect to images as well. See the examples below.

html img tag



html img tag



This entry was posted in Tips and Tricks. Bookmark the permalink.

One Response to CSS Rounded Corners and Shadows

  1. Pingback: How to Format HTML Img Tags: Borders and Shadows with CSS | CreateBetterWebsites.com

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>