About the Office of IT
Subscribe
Labels

September 02, 2011

Styling Web Content With CSS3

The world wide web continues to expand and the possibilities for design also continue to grow.  Anyone familiar with CSS knows that it is a great, flexible tool for creating great designs for websites.  Now with CSS3 the possibilities for design continue to grow.  Here are some of the new features:

Box Shadow
This a box shadow. In the past, this effect was very difficult to come by but now with one line of code it is done!
There are 4 attributes that need to be defined for this. The number of pixels right, below, the number of pixels to blur and the color of the drop shadow. The code for this is as follows:
#name{
box-shadow: 5px 5px 5px #888;
}

Another related effect is a text shadow:

If your browser supports text-shadows, this text should have a gray shadow behind it

Similar to the box shadow the same parameters need to be defined as follows:
p{
text-shadow: 2px 2px 2px #999;
}

One other amazing feature is the resize feature:
This little beauty will allow you to put a resizeable box on the page.
This one is really simple. Define the height and width and then simply add the resize rule:
#resize{
width: 100px;
height: 100px;
resize: both;
overflow: auto;
}

You can also only allow the box to resize in one direction by replacing "both" with "vertical" or "horizontal".

Since many of these styles are new, they will not work in all browsers so it is always a good idea to have a back up style in case your new cool CSS3 style does not work. You can check out many of the new styles at CSS3.info under the CSS3 Preview tab. It will show a preview of some of the new things in CSS3 as well as tell you which browsers support them and special code that is required for different browsers.
Maintained by the Office of IT Webmaster. Brigham Young University. All Rights Reserved.