Naruto
Naruto

Reputation: 1

Re-size web pages to suits visitors monitor resolution

I have designed a website site. I would like to know if it is possible to make pages in my site re-size to suite the visitors' monitor resolution.

For example, I'm using my computer with 1024x768 resolution. If I change my resolution to 800x600 I want my site to re-size to fit the screen resolution of 800x600.

Upvotes: 0

Views: 137

Answers (4)

wholerabbit
wholerabbit

Reputation: 11546

You don't want the resolution, since not everybody uses their browser fullscreen; you want the document size. There are ways to get that in plain javascript, but your best bet is to use a library like jquery, since that helps ensure your technique works cross-browser:

http://api.jquery.com/width/

But don't do that unless there is no other way to do what you want; first try using percentages in your CSS. Setting sizes with js is messy.

Upvotes: 0

Ashley Strout
Ashley Strout

Reputation: 6258

This is called "dynamic" or "fluid" width, as opposed to setting a "fixed" width on the page. This is usually done with CSS, as opposed to PHP or JavaScript. Do some research on the subject on Google (search for "dynamic width web pages"). I found this article.

Upvotes: 0

John Conde
John Conde

Reputation: 219834

Yes, it's called responsive design. Specifically look at media queries.

Upvotes: 2

Related Questions