{"id":165,"date":"2010-12-02T12:52:32","date_gmt":"2010-12-02T03:52:32","guid":{"rendered":"http:\/\/santoshkori.com\/blog\/?p=165"},"modified":"2012-03-05T22:25:05","modified_gmt":"2012-03-05T13:25:05","slug":"how-to-specify-css-hack-for-specific-browser-cross-browser-compatibility","status":"publish","type":"post","link":"https:\/\/www.santoshkori.com\/blog\/how-to-specify-css-hack-for-specific-browser-cross-browser-compatibility\/","title":{"rendered":"how to specify CSS hack for specific browser Cross browser compatibility"},"content":{"rendered":"<p>Here are some browser specific css hacks&#8230;.<\/p>\n<p><!--more--><\/p>\n<h2>\/***** Selector Hacks ******\/<\/h2>\n<p>\/* IE6 and below *\/<\/p>\n<p><strong>* html #uno { color: red }<\/strong><\/p>\n<p>\/* IE7 *\/<\/p>\n<p><strong>*:first-child+html #dos { color: red }<\/strong><\/p>\n<p>\/* IE7, FF, Saf, Opera *\/<\/p>\n<p><strong>html&gt;body #tres { color: red }<\/strong><\/p>\n<p>\/* IE8, FF, Saf, Opera (Everything but IE 6,7) *\/<\/p>\n<p><strong>html&gt;\/**\/body #cuatro { color: red }<\/strong><\/p>\n<p>\/* Opera 9.27 and below, safari 2 *\/<\/p>\n<p><strong>html:first-child #cinco { color: red }<\/strong><\/p>\n<p>\/* Safari 2-3 *\/<\/p>\n<p><strong>html[xmlns*=&#8221;&#8221;] body:last-child #seis { color: red }<\/strong><\/p>\n<p>\/* safari 3+, chrome 1+, opera9+, ff 3.5+ *\/<\/p>\n<p><strong>body:nth-of-type(1) #siete { color: red }<\/strong><\/p>\n<p>\/* safari 3+, chrome 1+, opera9+, ff 3.5+ *\/<\/p>\n<p><strong>body:first-of-type #ocho { color: red }<\/strong><\/p>\n<p>\/* saf3+, chrome1+ *\/<\/p>\n<p><strong>@media screen and (-webkit-min-device-pixel-ratio:0) {<br \/>\n#diez { color: red }<br \/>\n}<\/strong><\/p>\n<p>\/* iPhone \/ mobile webkit *\/<\/p>\n<p><strong>@media screen and (max-device-width: 480px) {<br \/>\n#veintiseis { color: red }<br \/>\n}<\/strong><\/p>\n<p>\/* Safari 2 &#8211; 3.1 *\/<\/p>\n<p><strong>html[xmlns*=&#8221;&#8221;]:root #trece { color: red }<\/strong><\/p>\n<p>\/* Safari 2 &#8211; 3.1, Opera 9.25 *\/<br \/>\n<strong>*|html[xmlns*=&#8221;&#8221;] #catorce { color: red }<\/strong><\/p>\n<p>\/* Everything but IE6-8 *\/<br \/>\n<strong>:root *&gt; #quince { color: red }<\/strong><\/p>\n<p>\/* IE7 *\/<\/p>\n<p><strong>*+html #dieciocho { color: red }<\/strong><\/p>\n<p>\/* Firefox only. 1+ *\/<\/p>\n<p><strong>#veinticuatro, x:-moz-any-link { color: red }<\/strong><\/p>\n<p>\/* Firefox 3.0+ *\/<\/p>\n<p><strong>#veinticinco, x:-moz-any-link, x:default { color: red }<\/strong><\/p>\n<h2>\/***** Attribute Hacks ******\/<\/h2>\n<p>\/* IE6 *\/<\/p>\n<p><strong>#once { _color: blue }<\/strong><\/p>\n<p>\/* IE6, IE7 *\/<\/p>\n<p><strong>#doce { *color: blue; \/* or #color: blue *\/ }<\/strong><\/p>\n<p>\/* Everything but IE6 *\/<\/p>\n<p><strong>#diecisiete { color\/**\/: blue }<\/strong><\/p>\n<p>\/* IE6, IE7, IE8 *\/<\/p>\n<p><strong>#diecinueve { color: blue\\9; }<\/strong><\/p>\n<p>\/* IE7, IE8 *\/<\/p>\n<p><strong>#veinte { color\/*\\**\/: blue\\9; }<\/strong><\/p>\n<p>\/* IE6, IE7 &#8212; acts as an !important *\/<\/p>\n<p><strong>#veintesiete { color: blue !ie; } \/* string after ! can be anything *\/<\/strong><\/p>\n<td>\u00a0<\/td>\n<p>\u00a0<\/p>\n<p>For that<\/p>\n<ul>\n<li>You can scan user Agent and find out which browser, its version. Including the OS for OS specific styles<\/li>\n<li>You can use various CSS Hacks for specific browser<\/li>\n<li>Or Scripts or Plugins to indentify the browser and apply various classes to the elements<\/li>\n<\/ul>\n<h2>Using PHP<\/h2>\n<p>See<\/p>\n<ul>\n<li><a rel=\"nofollow noopener\" href=\"http:\/\/php.net\/manual\/en\/function.get-browser.php\" target=\"_blank\">http:\/\/php.net\/manual\/en\/function.get-browser.php<\/a><\/li>\n<li><a rel=\"nofollow noopener\" href=\"http:\/\/techpatterns.com\/downloads\/php-browser-detection-basic.php\" target=\"_blank\">http:\/\/techpatterns.com\/downloads\/php-browser-detection-basic.php<\/a><\/li>\n<\/ul>\n<p>Then then create the dynamic CSS file as per the detected browser<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p>Source: <a rel=\"nofollow noopener\" href=\"http:\/\/paulirish.com\/2009\/browser-specific-css-hacks\/\" target=\"_blank\">http:\/\/paulirish.com\/2009\/browser-specific-css-hacks\/<\/a><\/p>\n<p>If you want to use Plugin then here is one<\/p>\n<p><a rel=\"nofollow noopener\" href=\"http:\/\/rafael.adm.br\/css_browser_selector\/\" target=\"_blank\">http:\/\/rafael.adm.br\/css_browser_selector\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some browser specific css hacks&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,73,17,47,14,4],"tags":[91,90,724,92],"class_list":["post-165","post","type-post","status-publish","format-standard","hentry","category-cross-browser-compatibility","category-joomla-web-development","category-tips-n-tricks","category-web-design","category-web-development","category-xhtml-coding","tag-browser-specific","tag-cross-browser","tag-cross-browser-compatibility","tag-css-hack-for-specific-browser"],"_links":{"self":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/comments?post=165"}],"version-history":[{"count":8,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":450,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/165\/revisions\/450"}],"wp:attachment":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/media?parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/categories?post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/tags?post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}