Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
Hello there - I'm designing my own small website using xhtml 1.0 and CSS. I've got the usual cross-browser issues, mainly with support for font sizes between Firefox and IE. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru fingal's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham - UK
    Posts
    1,539

    Cross-browser support for website


    Hello there - I'm designing my own small website using xhtml 1.0 and CSS. I've got the usual cross-browser issues, mainly with support for font sizes between Firefox and IE. I have a lot of work to do to get things the way I want them.

    Need some pointers if possible. My idea is to use two or more stylesheets for different browsers. Konqueror displays my site a lot like Explorer (I know some of you wouldn't want to support IE) ... So that shouldn't be much of a problem.

    Would like a javascript solution to detect different browsers and serve different stylesheets for each one. I've Googled around, but can't find anything good. I can't program in javascript - does anyone have a script to share which I can tweak? The site will link back to this forum eventually, but first I have to be happy with what I've written.

    The site will be part homepage, part rant, part creative writing and 'free stuff' and a lot of Linux advocacy. I hope to make it grow over time as I create new content. At the moment, it sucks ... It won't always
    I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso

  2. #2
    Linux Engineer Nerderello's Avatar
    Join Date
    Apr 2003
    Location
    North East England
    Posts
    1,190
    try this :-
    Code:
    <link rel="stylesheet" type="text/css" href="../base.css" >
      <script language="JavaScript">
      if &#40;navigator.appName.indexOf&#40;'Microsoft'&#41; != -1&#41;
      	document.write&#40;'<link href="../baseMS.css" rel="stylesheet" type="text/css">'&#41;;    
      </script>
    The link statement is the default css (ie. for browsers that are W3C compliant) and the script overwrites this if the browsers is one of Uncle Bills delights. It goes into the header part of your pages.

    have fun

    Nerderello

    Use Suse 10.1 and occasionally play with Kubuntu
    Also have Windows 98SE and BeOS

  3. #3
    Linux Guru fingal's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham - UK
    Posts
    1,539
    Thanks very much indeed! I'll try it out and see what happens. Looks very neat.

    ...

    A bit later on ... Seems to work well. I'm on an M$ box at the moment, so I'll test it on my Mandriva machine when I get home. I don't intend to write too many more stylesheets.

    My site - such as it is - also doesn't look too bad in Lynx.
    I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso

  4. #4
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    Quote Originally Posted by fingal
    Thanks very much indeed! I'll try it out and see what happens. Looks very neat.

    ...

    A bit later on ... Seems to work well. I'm on an M$ box at the moment, so I'll test it on my Mandriva machine when I get home. I don't intend to write too many more stylesheets.

    My site - such as it is - also doesn't look too bad in Lynx.
    Have you run the W3C validator on it? It's very interesting to see how non-standards compliant some sites are just to be compatible with IE. I personally try to keep myself W3C valid, flaunt it and tell IE to screw off.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  5. #5
    Linux Guru fingal's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham - UK
    Posts
    1,539
    Quote Originally Posted by sarumont
    Have you run the W3C validator on it? It's very interesting to see how non-standards compliant some sites are just to be compatible with IE. I personally try to keep myself W3C valid, flaunt it and tell IE to screw off.
    Not yet, though I intend to - I'm worried about it as then I'll have to reassess what I'm doing. I don't want to be completely reliant on IE, but I'm not kidding myself: after all it is still the dominant browser, and I want people to read about Linux (and other stuff) ... Then there's the issue of version 4 browsers not being fully CSS compliant. That might well be 'screw off' territory

    The javascript works very well, so thanks again. I don't think much of Konqueror as a browser though ... my font sizes are too large in there.
    I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso

  6. #6
    Linux Engineer Nerderello's Avatar
    Join Date
    Apr 2003
    Location
    North East England
    Posts
    1,190
    youn can check that code out, if you don't have access to IE, by using Opera's ability to pretend to be IE.

    As to W3C compliance, that code will work when you use :-
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http&#58;//www.w3.org/TR/html4/loose.dtd">
    but not when you use :-
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http&#58;//www.w3.org/1999/xhtml">
    What I dod is explain to people that my site may not look at its best with IE, and that if they follw the provided link, they can get themselves a compliant browser - Firefox.

    have fun

    Nerderello

    Use Suse 10.1 and occasionally play with Kubuntu
    Also have Windows 98SE and BeOS

  7. #7
    Linux Guru fingal's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham - UK
    Posts
    1,539
    Hello, thanks for your comments about this. I wondered why the validator was being rude about my code

    I also intend to include links to Firefox, with the idea of having a short page on 'technical issues' ... Useful to know about Opera as I haven't tried my code in that just yet. I think it's important to tout compliant browsers, and I read an article about the inroads Ffox is making into IE's market with delight :P

    I had hoped to include plenty of PNG graphics too, but IMHO IE does a poor job of rendering those - that and my graphic design skills are less than perfect
    I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso

  8. #8
    Just Joined!
    Join Date
    Feb 2005
    Location
    Delft, Holland
    Posts
    95
    Firefox is not fully compliant to the standards, slashdot had a story on all the big browsers failing the ACID test a month ago.

    Don't IE and Firefox still use the same engine BTW?

  9. #9
    Linux Guru Flatline's Avatar
    Join Date
    Feb 2005
    Posts
    2,204
    Don't IE and Firefox still use the same engine BTW?
    No. Firefox uses gecko (I think), while IE has its own engine.
    There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence.

    - Jeremy S. Anderson

  10. #10
    Linux Guru fingal's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham - UK
    Posts
    1,539
    Quote Originally Posted by Flatline
    Don't IE and Firefox still use the same engine BTW?
    No. Firefox uses gecko (I think), while IE has its own engine.
    I'll getting into these browser debates yep, Firefox definitely uses gecko - I don't really know if any browser is 100% compliant to standards, but a web designer once said in an article, 'If you make any page 100% compliant you're going to have one hell of a boring website' ... Functionality is fine, but the www is a media experience as well. And look at the power of the media: that is now in your hands as well *if* you get things right :o

    Konqueror is *based* on gecko, but renders things a lot differently. Opera renders a lot like IE if you ask me ... Funnily enough, it's not all that hard to get things looking okay - I'm just trying to keep things simple.
    I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •