WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > Browser Compatibility > [SOLVED] one css stylesheet

Reply
  Thread Tools Display Modes
Old 16th July 13, 07:27 PM   #1
ianhaney
WLC Lover
 
Join Date: Jun 2012
Posts: 78
Default one css stylesheet

Hi

I was wondering if someone could point me in the direction of how to use one css stylesheet for all browsers and screen sizes

I have tried all sorts and ended up with around 6 stylesheets, one for each browser and screen size

Am fed up of it

Must be a way of using stylesheet for all browsers and screen sizes

Please help

Kind regards

Ian
ianhaney is offline   Reply With Quote
Old 16th July 13, 10:09 PM   #2
meesa
WLC Mod
 
meesa's Avatar
 
Join Date: Jul 2009
Location: Milky Way Galaxy
Posts: 3,710
Default Re: one css stylesheet

Well, that really depends on what you're doing. In all the sites I've ever created, I've only had two, one for the menu, and one for everything else. I've never had the need to have an extra style sheet for one browser.
__________________
Praise be to the Lord God for the ability to learn, the capability to analyze, and the time to help users on this forum.
meesa is offline   Reply With Quote
Old 16th July 13, 10:36 PM   #3
Phreaddee
WLC Lover
 
Phreaddee's Avatar
 
Join Date: Oct 2010
Location: Newcastle, NSW, Australia
Posts: 768
Default Re: one css stylesheet

I usually have one main stylesheet and another for IE.

this usually works out well for me. cant say I've ever written a stylesheet for say Firefox or chrome specific...
Phreaddee is offline   Reply With Quote
Old 17th July 13, 07:14 AM   #4
ianhaney
WLC Lover
 
Join Date: Jun 2012
Posts: 78
Default Re: one css stylesheet

Hi meesa and Phreaddee

Thank you both for the replies

I have solved the issue now

I can paste the coding on how I managed to solve it if it helps others, let me know and will post it

Kind regards

Ian
ianhaney is offline   Reply With Quote
Old 17th July 13, 12:03 PM   #5
meesa
WLC Mod
 
meesa's Avatar
 
Join Date: Jul 2009
Location: Milky Way Galaxy
Posts: 3,710
Default Re: one css stylesheet

Feel free, just please wrap it in the [code] tags.
__________________
Praise be to the Lord God for the ability to learn, the capability to analyze, and the time to help users on this forum.
meesa is offline   Reply With Quote
Old 17th July 13, 12:37 PM   #6
ianhaney
WLC Lover
 
Join Date: Jun 2012
Posts: 78
Default Re: one css stylesheet

No worries

Below is the code used that solved my issue

Code:
<link id="size-stylesheet" rel="stylesheet" type="text/css" href="./css/style.css" />
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>

function adjustStyle(width) {
    width = parseInt(width);
    if (width <= 1024) {
        $("#size-stylesheet").attr("href", "./css/style.css");
    } else if ((width > 1100)) {
        $("#size-stylesheet").attr("href", "./css/wide.css");
    /*} else {
      $("#size-stylesheet").attr("href", "./css/style.css");*/
                }
}

$("document").ready(function(){
    adjustStyle($(window).width());
    $(window).resize(function() {
        adjustStyle($(window).width());
    });
});

</script>
ianhaney is offline   Reply With Quote
Old 1st August 13, 02:24 PM   #7
ronaldroe
WLC Lover
 
ronaldroe's Avatar
 
Join Date: Feb 2013
Posts: 197
Default Re: one css stylesheet

Why the JS? Use media queries.
ronaldroe is offline   Reply With Quote
Old 1st August 13, 02:29 PM   #8
ianhaney
WLC Lover
 
Join Date: Jun 2012
Posts: 78
Default Re: one css stylesheet

Hi ronaldroe

Thank you for the reply

I use media queries as well, am guessing media queries is better than using the js way
ianhaney is offline   Reply With Quote
Old 1st August 13, 07:25 PM   #9
ronaldroe
WLC Lover
 
ronaldroe's Avatar
 
Join Date: Feb 2013
Posts: 197
Default Re: one css stylesheet

Quote:
Originally Posted by ianhaney View Post
I use media queries as well, am guessing media queries is better than using the js way
Certainly easier, but also definitely more performant.
ronaldroe is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:08 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyrightę 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.