Home arrow Style Sheets arrow Page 6 - Double Vision – Give the Browsers CSS They Can Digest
STYLE SHEETS

Double Vision – Give the Browsers CSS They Can Digest


Some but not all browsers support CSS2. You can deliberately code your website so that users of either kind of browser will see pages that are appropriate for what their browser can handle. Older browsers won't gag, but you will still be able to take advantage of what you can do with CSS2 in the newer browsers. Read on to find out how.

Author Info:
By: Chris Heilmann
Rating: 5 stars5 stars5 stars5 stars5 stars / 15
February 22, 2005
TABLE OF CONTENTS:
  1. · Double Vision – Give the Browsers CSS They Can Digest
  2. · The way of the dark side – code forking
  3. · The way of confusion – browser hacks
  4. · The way into the future – progressive enhancement
  5. · The child selector
  6. · Enhancing with the child selector
  7. · The screen display style sheet
  8. · The print style sheet

print this article
SEARCH DEVARTICLES

Double Vision – Give the Browsers CSS They Can Digest - Enhancing with the child selector
(Page 6 of 8 )

Now, as MSIE on PC does not support the child selector, we can ensure that only browsers that can deal with certain styles get them. Normally this is done by preceding them with a html>body construct. This matches every BODY element inside the HTML element, a rather pointless definition in HTML documents, as those only allow for one body, but it makes sure that these styles are applied document-wide.

Example: An article style sheet

Let’s create a style sheet that makes it easy to read articles. We start with a properly marked up, valid HTML document (http://icant.co.uk/forreview/generating_nocss.html) that forces the browser to render in standards mode. This is all we will give old browsers like Netscape 4.x.  

For newer browsers, we apply the stylesheet "articles.css" (http://icant.co.uk/forreview/articles.css) for screen display and "print.css" (http://icant.co.uk/forreview/print.css) for printouts:

 

            <style type="text/css" media="screen">

         @import "articles.css";

    </style>

    <link rel="StyleSheet" href="print.css" media="print" type="text/css" />

 


blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Padding Overview
- CSS: Margins Overview
- Top CSS3 Button Tutorials
- More Top CSS3 Tutorials for Animation and Im...
- CSS Mega Menus: Adding Extra Sections
- CSS Mega Menus
- CSS3 Accordian Menu: Horizontally Display Hy...
- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials