Browser Specific Style Sheets

Discussion in 'other software & services' started by Bethrezen, Sep 27, 2005.

Thread Status:
Not open for further replies.
  1. Bethrezen

    Bethrezen Registered Member

    Joined:
    Apr 16, 2002
    Posts:
    546
    hi all

    Currently I have 2 style sheets one designed for browsers that render pages the same as IE and another for browsers that render pages the same way as firefox

    now I need a way tell each browser that might be used to view this page which style sheet to load

    if I can avoid it I don't really want to use java script for a few reasons

    1 I'm not familiar with java
    2 browser sniffing with java is unreliable as modern browsers allow people to spoof there user agent
    3 people have java disabled for obvious reasons

    currently I'm using the following code added to the head section of the document

    <LINK rel="stylesheet" type="text/css" href="Firefox-style.css"/>

    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="IE-style.css" />
    <![endif]-->

    now this is ok if people are using either fire fox or ie but what happens if they view the page with say opera we get problems because opera loads the wrong style sheet

    see iv found that opera renders pages in the same way as ie there for I want opera to load the ie style sheet

    only problem is iv been unable to find a way to make each browser load the style sheet that suits it best

    so does anyone know how this can be achieved ??
     
  2. Bethrezen

    Bethrezen Registered Member

    Joined:
    Apr 16, 2002
    Posts:
    546
    anyone ??

    perhaps it would be useful if people could see what I have already achieved

    http://home.ripway.com/2005-3/275289/Webpage/Troubl~1.htm

    now as stated above this should display ok in firefox and Internet Explore but wont display correctly in opera and may or may not display right in other browsers

    any one know how to solve this ?? because despite my best efforts I'm struggling with this one

    also should you have any suggestions for improvement then please do speak up
     
    Last edited: Oct 1, 2005
  3. Beef

    Beef Guest

    Bethrezen

    Have you consider PHP? Of course you do realize that today many User Agents are faked? This being the case does it really matter which sheet you use?
     
  4. Bethrezen

    Bethrezen Registered Member

    Joined:
    Apr 16, 2002
    Posts:
    546
    hi

    yeah and this is part of the problem I'm having because I cant seem to find a reliable way that don't rely on user agent sniffing to make each browser load the right set of display rules

    yeah I does because each browser displays things a lil differently so each browser needs to load its own set of display rules so that the page displays correctly in what ever browser its loaded in

    that is unless anyone has a better way to do what I'm trying to do that only requires 1 style sheet ?

    I suppose I could but wouldn't that would mean completely recoding everything from scratch again ? I mean only just got done coding it in html.

    Not to mention the fact that I'd actual have to learn php first and I'm not even done learning html yet so I'm some what reluctant to change focus half way through plus it really wouldn't solve my problem ultimatley I'd still have to find a way to make each browser load the correct set of display rules
     
    Last edited: Oct 2, 2005
Loading...
Thread Status:
Not open for further replies.