CMS Made Simple Forums
https://forum.cmsmadesimple.org/

To Target Specific Browsers:
https://forum.cmsmadesimple.org/viewtopic.php?f=20&t=29755
Page 1 of 1

Author:  Dr.CSS [ Sun Jan 11, 2009 6:28 am ]
Post subject:  To Target Specific Browsers:

To Target Specific Browsers:

#ID or .class is like div#main or div.main

* html #ID or .class {
  ie6
}

NOTE: sometimes IE6 requires...

* html body #ID or .class {
   ie6
}

*:first-child+html #ID or .class {
  ie7
}

#ID or .class, x:-moz-any-link, x:default {
   FF3
}

body:nth-of-type( ) #ID or .class {
   OLDER versions of: chrome and safari
}
      OR

body:nth-of-type(1) #ID or .class {
  chrome and safari, this will just target the 1st one
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
#ID or .class {
new versions of chrome and safari
}
}

First time ever I had to target Firefox only as all other browsers showed the same thing...

@-moz-document url-prefix() {
#ID or .class {
for latest firefox
}
}

Author:  CWebguy [ Sun Feb 15, 2009 3:52 pm ]
Post subject:  Re: To Target Specific Browsers:

Thanks for this.

Author:  christiaans [ Thu Mar 05, 2009 2:00 pm ]
Post subject:  Re: To Target Specific Browsers:

Could come in handy, but the thing is that your css will not validate.

Another option would be a simple javascript detection browser, and then passing on a class for that specific browser. (fairly easy to do, but only for specific elements and such..)

Author:  hexdj [ Sat Dec 12, 2009 8:36 am ]
Post subject:  Re: To Target Specific Browsers:

antosha wrote:
If I understand correctly, the tags in the template won't work?



They will work, you just have to wrap them in the smarty {literal}{/literal} tags for example:

Code:
{literal}
<!--[if IE 6]>
  <p>Your browser sucks</p>
<![endif]>
{/literal}

Author:  JeremyBASS [ Fri Mar 05, 2010 5:10 pm ]
Post subject:  Re: To Target Specific Browsers:

Just figured I throw this here.. a handy tool I use alot for this.. browsertools Cheers -Jeremy

Author:  Inzman [ Thu Oct 14, 2010 1:19 pm ]
Post subject:  Re: To Target Specific Browsers:

There's also a way with javascript:
http://rafael.adm.br/css_browser_selector/

Very handy script, can target browsers and their different versions.

Author:  rooon [ Sun Oct 07, 2012 1:42 pm ]
Post subject:  Re: To Target Specific Browsers:

Or use browser detection
for example viewtopic.php?f=4&t=63334

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/