View Full Version : *HTML CSS Code Question
jollymoon
09-18-2008, 03:55 AM
This is silly.
I just spent three hours wading through CSS related sites, HTML Cheat Sheets, Typography junk, etc.
What is the *HTML code in a CSS external sheet? *HTML #nav { BACKGROUND: #2F3F3F} or
* HTML .clearfix { HEIGHT: 1%}
This is driving me crazy. Shouldn't be that hard to find an answer.
HELP
jollymoon
09-18-2008, 04:06 AM
Almost found something?
CSS Cheat Sheet (V1) - Cheat Sheets - Added Bytes (http://www.addedbytes.com/cheat-sheets/css-cheat-sheet-version-1/)
lists a cheat sheet * as "all elements"
uhh, ok?
Dubbya
09-18-2008, 01:59 PM
"* HTML" is a CSS hack which is used to cater code specifically to IE6 and below. It allows developers to take advantage of a known bugs in the browser software.
CSS Hacks can be applied to any web page element that CSS can alter.
In this case, if I want negative padding applied to a named div when a page is displayed in IE6 or below, I might do this:
* html #testdiv {padding-bottom:-2px;}
Firefox, Opera and Safari browsers would ignore the hack so, for them I'd code in the standard fashion.
div#testdiv {padding:10px;}
* html #testdiv {padding-bottom:-2px;}
The hacked CSS should always be placed after standard code so that the targeted browser applies the hack.
For more info on CSS Selectors and hacks, check out:
CSS Hacks (http://www.webdevout.net/css-hacks)
enjoy!
sheanhoxie
09-20-2008, 12:31 PM
Yea IE hack, best not to use a hack though, you should use a separate stylsheet for IE instead of hacks.
To do: Create two stylesheets, one for FF one for IE. Call the FF stylesheet first in your head, then call your IE stylesheet using this code:
<!--[if IE]>
<link rel="stylesheet" href="ie_stylesheet.css" type="text/css" />
<![endif]-->
This allows you to create one stylesheet that works for FF/Opera browsers, and then you can tidy up any quirks in IE by overriding with your IE stylesheet and still have w3 compliant code