internet explorer 7 - combining IE6 and IE7 css hacks in same stylesheet -


i use ie conditionals , have stylesheet each. me neater way this. due constraints, have hack ie6 , 7 in same stylesheet.

i know won't validate, how isolate ie6 , ie7 hacks in same stylesheet?

comprehensive list of browser-specific css hacks

source: http://paulirish.com/2009/browser-specific-css-hacks/

/***** selector hacks ******/  /* ie6 , below */ * html #uno  { color: red }  /* ie7 */ *:first-child+html #dos { color: red }   /* ie7, ff, saf, opera  */ html>body #tres { color: red }  /* ie8, ff, saf, opera (everything ie 6,7) */ html>/**/body #cuatro { color: red }  /* opera 9.27 , below, safari 2 */ html:first-child #cinco { color: red }  /* safari 2-3 */ html[xmlns*=""] body:last-child #seis { color: red }  /* safari 3+, chrome 1+, opera9+, ff 3.5+ */ body:nth-of-type(1) #siete { color: red }  /* safari 3+, chrome 1+, opera9+, ff 3.5+ */ body:first-of-type #ocho {  color: red }  /* saf3+, chrome1+ */ @media screen , (-webkit-min-device-pixel-ratio:0) {  #diez  { color: red  } }  /* iphone / mobile webkit */ @media screen , (max-device-width: 480px) {  #veintiseis { color: red  } }   /* safari 2 - 3.1 */ html[xmlns*=""]:root #trece  { color: red  }  /* safari 2 - 3.1, opera 9.25 */ *|html[xmlns*=""] #catorce { color: red  }  /* ie6-8 */ :root *> #quince { color: red  }  /* ie7 */ *+html #dieciocho {  color: red }  /* firefox only. 1+ */ #veinticuatro,  x:-moz-any-link  { color: red }  /* firefox 3.0+ */ #veinticinco,  x:-moz-any-link, x:default  { color: red  }    /***** attribute hacks ******/  /* ie6 */ #once { _color: blue }  /* ie6, ie7 */ #doce { *color: blue; /* or #color: blue */ }  /* ie6 */ #diecisiete { color/**/: blue }  /* ie6, ie7, ie8 */ #diecinueve { color: blue\9; }  /* ie7, ie8 */ #veinte { color/*\**/: blue\9; }  /* ie6, ie7 -- acts !important */ #veintesiete { color: blue !ie; } /* string after ! can */ 

be sure check out other solutions using javascript libraries purpose: recommend http://www.modernizr.com supported same author of above list of hacks paul irish. modernizr can sometihng like:

#menu{ .. } .ie6 #menu{ .. } .ie7 #menu{ .. } 

instead of hacking, cleaner code, easier understand.

also suggest check http://www.quirksmode.org/, has complete list of supported browser features , compatibility.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -