Author Topic: Website look changes with the resolution  (Read 1134 times)

0 Members and 1 Guest are viewing this topic.

Offline paragkalraTopic starter

  • Irregular
  • Posts: 29
  • Gender: Male
    • View Profile
    • paragkalra.com
Website look changes with the resolution
« on: February 02, 2009, 11:34:57 AM »
Hello Folks,

I am a newbie in this world of web-development. I have made my own website. However the website looks different when opened on different machines having different screen resolution.

Is there a way we can make sure the website structure is independent of the screen resolution of the machine on which it is accessed?
« Last Edit: February 02, 2009, 11:35:30 AM by paragkalra »
Parag.A.Kalra, The Linux Man
http://www.paragkalra.com/
In this world without WALLS and GATES who need WINDOWS! USE LINUX! STOP PIRACY! GO OPEN SOURCE!

Offline BlueBoden

  • Enthusiast
  • Posts: 302
  • Gender: Male
    • View Profile
    • BlueBoden's Blog
Re: Website look changes with the resolution
« Reply #1 on: February 02, 2009, 01:28:35 PM »
Not entirely. You can however avoid the most common bad-practices, such as. Locking the font-size or fixing the layout using pixels.

Now i usually add something along the lines of below to my own layouts.
Code: [Select]
* {
  margin: 0;
  padding: 0;
}
#Basement {
  width: 90%;
  max-width: 1600px;
  min-width: 668px;
}

The reason i use the star to remove margin and padding on everything, is because i likely need to change these values anyway, and finally it solves quite a few browser specific issues. For lists that would be the issue where one browser uses margin, while the other uses padding.

Be sure to set your font-sizes with either percentages or em as well, pixels would be the last option i would chose.

Offline deadlyp99

  • Enthusiast
  • Posts: 116
    • View Profile
Re: Website look changes with the resolution
« Reply #2 on: February 03, 2009, 11:29:28 PM »
Also people with a widescrean monitor will see it differently despite the percentages.

You can use javascript to detect the browser and resolution/width/height, and load up a different style sheet tailored for them.

For instance I find that %20 margins are nice on my 19" wide screen, but leave people with square monitors with a very slim area of content, so I do that to make margins for them about... half of my wide screen.

Offline haku

  • Guru
  • Freak!
  • *
  • Posts: 5,707
  • Old Man
    • View Profile
Re: Website look changes with the resolution
« Reply #3 on: February 04, 2009, 11:35:16 AM »
I'd wager a guess that you are using absolute positioning in your layout. Is this correct?

Offline BlueBoden

  • Enthusiast
  • Posts: 302
  • Gender: Male
    • View Profile
    • BlueBoden's Blog
Re: Website look changes with the resolution
« Reply #4 on: February 14, 2009, 05:24:44 AM »
I don't work with percentages for margins, nor padding. At Least i usually don't.

I find it far better to use em's for margins, as well as far more secure then percentages.


Don't use JavaScript to change the stylesheet, use PHP instead. A good rule of thumb is that your site should fit nicely into the most common of screen resolutions, without modifying the styles based on resolution, widescreen is no exception in this case.
« Last Edit: February 14, 2009, 05:28:12 AM by BlueBoden »

Offline haku

  • Guru
  • Freak!
  • *
  • Posts: 5,707
  • Old Man
    • View Profile
Re: Website look changes with the resolution
« Reply #5 on: February 14, 2009, 06:23:57 AM »
You don't need to use javascript OR php for layouts. If they are done right, they can (and usually are) done purely in CSS. There are different ways of doing it - fixed width layouts, FNE (float nearly everything) layouts, expandable layouts and jello layouts are all done purely in CSS, and when coded right, work on whichever monitor side and resolution they are shown on.

Offline andrewsCWD

  • Irregular
  • Posts: 6
  • Gender: Male
    • View Profile
    • Andrew's Custom Web Design
Re: Website look changes with the resolution
« Reply #6 on: February 22, 2009, 03:10:12 AM »
I agree with haku.

I don't use php or javascript for browser detection on my website. It's just xhtml and css. It displays fine at 800x600 up to 1440 on my widescreen 17inch. I've tested it on my mothers 13inch laptop square screen and a 15 inch widescreen laptop at 1280x800. I have never tested it on anything bigger though, as I don't own anything bigger. So it might look like crap at a large resolution ???

It's not the best website, I imagine someone could code it better. But it seems to be quite resolution friendly and browser friendly at the moment without any browser detection for switching stylesheets.