Skip to main content

Diigo Home

How to Design a CSS Web Site for Both Firefox and Internet Explorer - The Diigo Meta page

webdesign.about.com/...aa082906.htm - Cached - Annotated View

Powmow 's personal annotations on this page

powmow
Powmow bookmarked on 2008-12-12
  • Hiding Styles from IE 6


    It's actually really easy to hide styles from IE 6 but make them visible to standards compliant browsers. Use child selectors.

    In one design I built, I created a two column layout that required margins and padding. This meant that I was hitting the box model differences when I viewed the page in IE 6. My first CSS style sheet for Firefox included a line like this:

    div#nav { width: 150px; margin-left: 20px; }

    This made the page line up perfectly in Firefox and Safari, but in IE the nav column was pushed over to the right too far.

    So, I converted the line to use child selectors. The #nav div is a child of the body tag, so I changed the line to read:

    body > div#nav { width: 150px; margin-left: 20px; }

    Of course, doing this made the #nav div lose all it's properties in IE, so I needed to add in some IE styles to get IE 6 looking okay. I added this line to the CSS:

    #nav { width: 150px; margin-left: 10px; }

    The placement of this line of CSS is important if my page is still to look good in Firefox and Safari. The IE line needs to come first. Firefox and Safari will read that line and then it will be over-ridden by the body > div#nav selector lower in the document. IE 6 will read the first line and set the styles. It will then ignore the child selector, as it doesn't recognize them. When IE 7 comes along, it will act like Firefox and Safari.

  • Hiding Styles from IE 6


    It's actually really easy to hide styles from IE 6 but make them visible to standards compliant browsers. Use child selectors.

    In one design I built, I created a two column layout that required margins and padding. This meant that I was hitting the box model differences when I viewed the page in IE 6. My first CSS style sheet for Firefox included a line like this:

    div#nav { width: 150px; margin-left: 20px; }

    This made the page line up perfectly in Firefox and Safari, but in IE the nav column was pushed over to the right too far.

    So, I converted the line to use child selectors. The #nav div is a child of the body tag, so I changed the line to read:

    body > div#nav { width: 150px; margin-left: 20px; }

    Of course, doing this made the #nav div lose all it's properties in IE, so I needed to add in some IE styles to get IE 6 looking okay. I added this line to the CSS:

    #nav { width: 150px; margin-left: 10px; }

    The placement of this line of CSS is important if my page is still to look good in Firefox and Safari. The IE line needs to come first. Firefox and Safari will read that line and then it will be over-ridden by the body > div#nav selector lower in the document. IE 6 will read the first line and set the styles. It will then ignore the child selector, as it doesn't recognize them. When IE 7 comes along, it will act like Firefox and Safari.

  • Hiding Styles from IE 6


    It's actually really easy to hide styles from IE 6 but make them visible to standards compliant browsers. Use child selectors.

    In one design I built, I created a two column layout that required margins and padding. This meant that I was hitting the box model differences when I viewed the page in IE 6. My first CSS style sheet for Firefox included a line like this:

    div#nav { width: 150px; margin-left: 20px; }

    This made the page line up perfectly in Firefox and Safari, but in IE the nav column was pushed over to the right too far.

    So, I converted the line to use child selectors. The #nav div is a child of the body tag, so I changed the line to read:

    body > div#nav { width: 150px; margin-left: 20px; }

    Of course, doing this made the #nav div lose all it's properties in IE, so I needed to add in some IE styles to get IE 6 looking okay. I added this line to the CSS:

    #nav { width: 150px; margin-left: 10px; }

    The placement of this line of CSS is important if my page is still to look good in Firefox and Safari. The IE line needs to come first. Firefox and Safari will read that line and then it will be over-ridden by the body > div#nav selector lower in the document. IE 6 will read the first line and set the styles. It will then ignore the child selector, as it doesn't recognize them. When IE 7 comes along, it will act like Firefox and Safari.

  • Hiding Styles from IE 6


    It's actually really easy to hide styles from IE 6 but make them visible to standards compliant browsers. Use child selectors.

    In one design I built, I created a two column layout that required margins and padding. This meant that I was hitting the box model differences when I viewed the page in IE 6. My first CSS style sheet for Firefox included a line like this:

    div#nav { width: 150px; margin-left: 20px; }

    This made the page line up perfectly in Firefox and Safari, but in IE the nav column was pushed over to the right too far.

    So, I converted the line to use child selectors. The #nav div is a child of the body tag, so I changed the line to read:

    body > div#nav { width: 150px; margin-left: 20px; }

    Of course, doing this made the #nav div lose all it's properties in IE, so I needed to add in some IE styles to get IE 6 looking okay. I added this line to the CSS:

    #nav { width: 150px; margin-left: 10px; }

    The placement of this line of CSS is important if my page is still to look good in Firefox and Safari. The IE line needs to come first. Firefox and Safari will read that line and then it will be over-ridden by the body > div#nav selector lower in the document. IE 6 will read the first line and set the styles. It will then ignore the child selector, as it doesn't recognize them. When IE 7 comes along, it will act like Firefox and Safari.

  • Hiding Styles from IE 6


    It's actually really easy to hide styles from IE 6 but make them visible to standards compliant browsers. Use child selectors.

    In one design I built, I created a two column layout that required margins and padding. This meant that I was hitting the box model differences when I viewed the page in IE 6. My first CSS style sheet for Firefox included a line like this:

    div#nav { width: 150px; margin-left: 20px; }

    This made the page line up perfectly in Firefox and Safari, but in IE the nav column was pushed over to the right too far.

    So, I converted the line to use child selectors. The #nav div is a child of the body tag, so I changed the line to read:

    body > div#nav { width: 150px; margin-left: 20px; }

    Of course, doing this made the #nav div lose all it's properties in IE, so I needed to add in some IE styles to get IE 6 looking okay. I added this line to the CSS:

    #nav { width: 150px; margin-left: 10px; }

    The placement of this line of CSS is important if my page is still to look good in Firefox and Safari. The IE line needs to come first. Firefox and Safari will read that line and then it will be over-ridden by the body > div#nav selector lower in the document. IE 6 will read the first line and set the styles. It will then ignore the child selector, as it doesn't recognize them. When IE 7 comes along, it will act like Firefox and Safari.

    By designing for a standards-compliant browser first, and then modifying your CSS to support IE's quirks, you spend a lot less time fiddling with the design and a lot more time

This link has been bookmarked by 6 people . It was first bookmarked on 21 Dec 2006, by Stuart Maxwell.

  • 27 Sep 09
    ameeno
    Ameeno

    The placement of this line of CSS is important if my page is still to look good in Firefox and Safari. The IE line needs to come first. Firefox and Safari will read that line and then it will be over-ridden by the body > div#nav selector lower in the document. IE 6 will read the first line and set the styles. It will then ignore the child selector, as it doesn't recognize them. When IE 7 comes along, it will act like Firefox and Safari.

    CSS HACK css webdesign

  • 03 Apr 09
  • 12 Dec 08
    • Hiding Styles from IE 6


      It's actually really easy to hide styles from IE 6 but make them visible to standards compliant browsers. Use child selectors.

      In one design I built, I created a two column layout that required margins and padding. This meant that I was hitting the box model differences when I viewed the page in IE 6. My first CSS style sheet for Firefox included a line like this:

      div#nav { width: 150px; margin-left: 20px; }

      This made the page line up perfectly in Firefox and Safari, but in IE the nav column was pushed over to the right too far.

      So, I converted the line to use child selectors. The #nav div is a child of the body tag, so I changed the line to read:

      body > div#nav { width: 150px; margin-left: 20px; }

      Of course, doing this made the #nav div lose all it's properties in IE, so I needed to add in some IE styles to get IE 6 looking okay. I added this line to the CSS:

      #nav { width: 150px; margin-left: 10px; }

      The placement of this line of CSS is important if my page is still to look good in Firefox and Safari. The IE line needs to come first. Firefox and Safari will read that line and then it will be over-ridden by the body > div#nav selector lower in the document. IE 6 will read the first line and set the styles. It will then ignore the child selector, as it doesn't recognize them. When IE 7 comes along, it will act like Firefox and Safari.

    • Hiding Styles from IE 6


      It's actually really easy to hide styles from IE 6 but make them visible to standards compliant browsers. Use child selectors.

      In one design I built, I created a two column layout that required margins and padding. This meant that I was hitting the box model differences when I viewed the page in IE 6. My first CSS style sheet for Firefox included a line like this:

      div#nav { width: 150px; margin-left: 20px; }

      This made the page line up perfectly in Firefox and Safari, but in IE the nav column was pushed over to the right too far.

      So, I converted the line to use child selectors. The #nav div is a child of the body tag, so I changed the line to read:

      body > div#nav { width: 150px; margin-left: 20px; }

      Of course, doing this made the #nav div lose all it's properties in IE, so I needed to add in some IE styles to get IE 6 looking okay. I added this line to the CSS:

      #nav { width: 150px; margin-left: 10px; }

      The placement of this line of CSS is important if my page is still to look good in Firefox and Safari. The IE line needs to come first. Firefox and Safari will read that line and then it will be over-ridden by the body > div#nav selector lower in the document. IE 6 will read the first line and set the styles. It will then ignore the child selector, as it doesn't recognize them. When IE 7 comes along, it will act like Firefox and Safari.

    • 3 more annotations...
  • 27 Oct 08
  • 21 Dec 06
    • Tips and Tricks to Get Your Site Looking Right in Both Browsers
  • 14 Sep 06