php - How to write specific CSS for mozilla, chrome and IE -


what css conditional statement can use include specific css ie, mozilla, chrome.

if ie   #container { top: 5px; }    if mozilla  #container { top: 7px; }      if chrome   #container { top: 9px; } 

what respective 'if's' ?

for that

  • you can scan user agent , find out browser, version. including os os specific styles
  • you can use various css hacks specific browser
  • or scripts or plugins indentify browser , apply various classes elements

using php

see

then create dynamic css file per detected browser

here css hacks list

/***** 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 */ 

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

if want use plugin here one

http://rafael.adm.br/css_browser_selector/


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -