Member since Aug 10, 2006, follows 0 people, 0 public groups, 612 public bookmarks (646 total).
More »
Tags
| Recent Tags: | |
|---|---|
| Top Tags: |
More »
Recent Bookmarks and Annotations
- executor.dk on 2009-01-07
-
How to Design a CSS Web Site for Both Firefox and Internet Explorer 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.
- 3 more annotations...
-
- ammo media sales on 2008-11-18
- Amazoner: Build Amazon Assosciate Links Easily on 2006-10-31
- Course of Actions - Task Flow Mapping Your Day - lifehack.org on 2006-10-29
- About:config entries - MozillaZine Knowledge Base on 2006-10-26
- Give your résumé a face lift » LifeClever ;-) on 2006-10-26
- Adobe Labs - Adobe Soundbooth on 2006-10-26
- Greater Union Birch Carroll & Coyle Cinemas Australia on 2006-10-25
- Showcase City Cinemas - Wolfe street Newcastle on 2006-10-25
Recent Visitors (63 visits)
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo