There's loads of stuff on the web about CSS3 so I won't bore you with the details and the fact that you won't be able to use them for ten years until every last trace of IE6 and 7 has been eradicated. I just wanted to show you what I believe are the five coolest effects you will (eventually) be able to create with full CSS3 support.
IE users may as well look away now. This isn't going to be for you!
Ever wanted to give your boxes a cool shadow effect without using images? Well, with CSS3 support, you are able to. The code is simple to use and has the attribute box-shadow. You need to tell the browser four things in your code.
This is what the code for the example below would look like;
#box1 {
background-color: #09f;
box-shadow: 8px 8px 5px #888;
padding: 5px;
}
And here is the result;
Just whilst we are getting jiggy with the shadows we can add some drop shadow effects to text with CSS3 as well. Much like the box shadow property above you need to give it four attributes.
This is what the code for the example text below would look like;
#text1 {
color: #06F;
font: bold normal 18px/22px Verdana, Arial, Sans-serif;
text-shadow: 2px 2px 2px #888;
}
And here is the result;
OK, before you say it, I know that this is CSS2 really. I wanted to include it as something that is now widely supported by browsers and will be a much loved feature of CSS3.
As Homer Simpson might say..."mmmmm...rounded corners". This effect is achieved using the border-radius attribute. This is what the code for the example below would look like;
#box2 {
background-color: #06f;
border-radius: 5px;
border: 2px solid #333;
padding: 10px;
}
And here is the result;
Carrying along the border theme for my next trick, let's try using an image for a border. At the time of writing this, support for this property is handled by Safari, Firefox 3.5 and upwards and Chrome. The attributes are broken down into shorthands for;
border-image:This is what the code for the example text below would look like;
#box 3 {
width: 80%;
padding: 14px;
border-image: url('images/tips_images/css3_tut1/border_img.png') 20 20 20 20 round round;
}
And here is the result;
One more quick trick with a border image is to make it stretch by changing the code slightly;
#box 4 {
width: 80%;
padding: 14px;
border-image: url('images/tips_images/css3_tut1/border_img.png') 20 20 20 20 stretch stretch;
}
Now the box looks like this;
Saving the best 'til last I reckon. Adding opacity to a div means that you can get really cool masking effects over images. It also probably the simplest one to master. Here is the code for the example below;
#box5 {
background-color: #fff;
color: #000;
width: 285px;
opacity: 0.7;
}
And here is the effect it all it's glory;
You'll notice for this one I used an opacity value of 0.7. This can easily be adjusted between 0.1 and 0.9 to achieve the effect you want.
I hope you have enjoyed this brief journey into five cool CSS3 Tricks. I have had a lot of fun researching and getting it all to work. If you are missing the point and viewing in an older browser then do yourself a favour and upgrade! You won't get the benefits of CSS3 until you do.