Rank: Advanced Member Groups: Member
Joined: 1/31/2008 Posts: 55 Points: 165 Location: India
|
Importing and Combining CSS Styleshi all
do anybody guide me how to import and combine CSS styles please
regards
|
Rank: Advanced Member Groups: Member
Joined: 8/18/2008 Posts: 44 Points: 132 Location: India
|
Importing and Combining CSS StylesServing presentational information with the @import rule is a key part of web standards flexibility. The site structure—the actual content—is uncompromised, and you are free to make separate choices about the presentational styling. The @import rule was not designed to be used in the (X)HTML document, and is meant as a method for importing one or more style sheets via the main external style sheet. However, by importing an external style sheet via the (X)HTML, you can ensure that old browsers such as Netscape 4.x and IE4 ignore specific styles. You would then provide a standard link to an external style sheet for those browsers. We’ll look at further uses of @import in Chapter 2, but first it is worthwhile to gain a basic understanding of how this method works.
The following example assumes you created the style sheet external.css in the previous section:
1. Open imported.html in your text editor.
2. Within the <head> section, and after the <title> element, paste the element <style type="text/css">@import url(external.css);</style> and save the file.
3. Save imported.html and view it in the browser.
Nothing looks any different, and the paragraphs are still red, but you’ve just taken a very important step toward sensible and productive style sheet management, which you’ll find out more about in the “Maintaining and Organizing Style Sheets” section that follows shortly. The @import rule is particularly useful for hiding your style sheet from old and infirm browsers with poor CSS support, such as Netscape 4.x, which don’t support @import. Rather than attempt to do something half-useful with your CSS, that browser will just completely ignore your style sheet and leave the (X)HTML unstyled. If you served the CSS as usual, and poor old Netscape tried to follow its rules, it would more than likely balk at many of them and produce an unhinged mess, which is best avoided.
|