Different CSS depending on Screen Resolution

Discussion in 'CSS' started by DEVIL, Jan 17, 2007.

  1. #1
    How to have a different css depending on the user screen resolution

    Example .

    a user with 800 * 600 resolution should view a css file 1.css

    a user with 1024 * 800 resolution should view a css file 2.csss

    i guess there should be some if and else statements ..not sure exactly what to do ...can anyone help me out with it

    Thanks in Advance
     
    DEVIL, Jan 17, 2007 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    That's a Bad Idea®. There is no way to do that without client side scripting, and there's no guarantee that the user will have scripting enabled. Further, he may reset his window size to any value at any time. On my Linux box, I can even make the window larger than the monitor size. How would you deal with that? Why would you?

    CSS provides the means to make your layout fixed, elastic or completely liquid. There is no sane reason to do what you propose.

    cheers,

    gary
     
    kk5st, Jan 17, 2007 IP
  3. AdamSee

    AdamSee Well-Known Member

    Messages:
    422
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    135
    #3
    AdamSee, Jan 17, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Switchy McLayout SUCKS. And I don't say that lightly either. I also find it funny that the main thing "Switchy" is designed for (mobile users) isn't even supported by most mobile devices.

    Until CSS3 is supported properly by all four of the major rendering engines (given Microsoft's lax attitude for standards, probably not until 2020 or so - again, something I do not say lightly), your best bet will be to create an elastic layout (one that is capable of text-resizing without breaking the layout) that also expands and contracts depending on the available real estate in the browser window (thus the "liquid" or "fluid" part of "liquid layout" and "fluid layout).
     
    Dan Schulz, Jan 22, 2007 IP