Softpedia
 

NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home > News > Webmaster

September 7th, 2009, 09:20 GMT · By Catalin Cimpanu

Three New Tricks in CSS3

SHARE:

Adjust text size:


CSS3 will change the way we style websites
Enlarge picture
CSS3 is still in the works, but several working drafts have been released to get a feel of how this will change the way we now view CSS. Shown below is a list of CSS3 properties that will surely be used to enhance website looks.

Multiple Background Images

Since everyone has renegaded tables from modern-day design, multiple background images have been hard to replicate. To work around this inconvenience, web-designers have long been using a trick called “tag-backing” to simulate this feature.

Let's say that you have a background that can't be made up of just one image put in the body tag as the main background. You have a high-resolution photo, a gradient underneath it and a plain color for the rest of the website (if it would need to scroll down).

Usually, using tag-backing, you would put the color as the background for the HTML tag, the gradient in the body tag, and, finally, the high-resolution photo as a background for a div tag. Well, no more of this.

Using the new, improved “background-image” property in CSS3, background images can be simply lain on top of each other inside a simple CSS line. Every image is declared as in CSS2, separated by comma, the first image being on top of the next.

CODE
background-image: url(softpedia1.jpg), url(softpedia2.jpg), url(softpedia3.jpg);


Text Shadowing

Old-school designers, back in the day when Flash and JavaScript were just simple drafts and sIFR was something in the domain of science-fiction, remember pioneering a technique where a text with special effects would have been rendered in image-editing software and then exported to an image format like PNG, GIF or JPEG.

The resulted image was included in the website using an img tag. This practice is still in usage today in many places where font styling is needed.

The “text-shadow” property will add a blurred shadow effect to any text. Its usage is a bit complicated for an untrained eye. Its syntax is the following:

CODE
text-shadow: 1px 2px 3px #333333;


The first two values control the direction the shadow drops. The 1px value says that the shadow will drop 1 pixel to the right and controls the horizontal plane. For negative values, the shadow will drop to the left.

The second value controls the vertical plane and, for positive values, will drop the shadow down, for negative values, the shadow will go up.

The third value (ex. 3px) will control the blur effect. This example will have a 3-pixel blur.

The last value is, as expected, the color of the shadow. No science in this one.

Non-Standard Web Fonts

First implemented in Internet Explorer 5, the @font-face rule will be a standard in the new CSS3. The syntax is as follows.

CODE
@font-face {
    font-family: Softpedia-Font;
    src: url('Softpedia-Normal.otf');
        }


This will make the user's browser access the given URL and download the given font to be employed inside that page. Currently, the CSS3 standard will support the OTF, TTF and EOT font types.

If a weighted or italic version of the font is needed, that form of the font-family must be included in the rule, as well as in a separate declaration, as follows:

CODE
@font-face {
    font-family: Softpedia-Font;
    src: url('Softpedia-Bold.ttf');
    font-weight: bold;
        }


Whenever the font is needed, it can be called as normal, using the declared font-family name.

TELL US WHAT YOU THINK:

3,093 hits · Link to this article · Print article · Send to friend · Subscribe to news

MUST-READ RELATED ARTICLES:


No Codec Requirements for the HTML 5 Standard

Copywriting, Useful Tips and Resources

How to Become a Gmail Ninja

Google's Billion-Dollar HTML Tag

Mozilla Labs Prepares TestSwarm, the Latest Project from John Resig

READER COMMENTS:



No user comments yet.
Be the first to express your opinion!
Copyright © 2001-2012 Softpedia. Contact/Tip us at

WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM