Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Browser Compatability

Featured Replies

Hello,

 

Whats the best way to load a style sheet for a specific browser, Example, if a user was to use IE, the website would load the stylesheet for IE, if they was to use firefox it would load a style sheet for firefox.

It's easier if you code the link for all browsers except IE first and then code conditional comment(s) for versions of IE afterwards in the head section.

<link rel="stylesheet" href="style1.css" media="all" type="text/css">
<!--[if ie 6]> <link rel="stylesheet" href="ie6.css" media="all" type="text/css"> <![endif]-->

 

If you want to target a specific browser like Firefox but not Safari,IE, etc. that's more difficult and usually shouldn't be necessary. I think you can use javascript to sniff for Firefox and then feed a different stylesheet, but I've never needed to do it.

Thanks mate,

 

So if the user has IE6 the code above will load the IE6 Stylesheet instead of the default one?

Not "instead". It will load in the main one AND then the IE6 one if the visitor is on IE6. In your IE stylesheet you only need styles for the borken elements - not the full stylesheet again ;)

Yes. Browsers process from the top down, so a browser will process all the main stylesheet styles and then, if it's the stated IE version in the conditional comment, will overwrite with the styles for the IE version.

 

You can have several conditional comments for different IE versions or just one for all IE versions. Usually you only need one for "lt IE 7" which means all IE versions less than IE7.

http://www.javascriptkit.com/howto/cc2.shtml

  • Author

Thank you very much guys for all your help, I actual forgot the browser processes from top the bottom, i dont understand why IE, Firefox and any other browser dont just come togeather and make it work for everyone instead of causing webdesigners problems all the time... P*sses me of and its ALWAYS something to do with IE

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.