If this is found somewhere else, I'm sorry for bring it back up, I just could not find it anywhere.
My problem is that I have a webpage that is setup using <div> and is designed at 1024. I recently had someone tell me that it does not look good on their machine, which is set and 800. So, I redesigned to 800 and it checked it. OK. Went back to 1024, and yes it was visible an it would work, but I didn't like how the layout looked.
I have seen where java can resize a pop-up window by the resolution of the end users computer. Can java be used in the initial load to select different CSS files to be determined by the resolution of the users computer?
So, if a computer is set for 1024 - CSS1024 is selected; if a computer is set to 800 - CSS800 is selected; or, if another is set to 200 (such as a handheld) - CSS200 is selected.

If I am way off base, just let me know. Since I switched to <div>, I prefer it over <table>.

Thanks,
Wayne

Recommended Answers

All 4 Replies

You looking for JavaScript not Java, These two are very distinct technologies with similar names. And yes such thing can be done with JavaScript, simple search from google got me all these

Suggestions on doing it without JavaScript:

- Use percentage sizes.

- Don't use pixel sizes.

- No images larger than 400 px, unless it will be alone in the horizontal dimension. In that case, no images larger than 640 px.

- Leave enough space for the parts to move farther apart or closer together as the window size changes.

- Don't put size styles (width, height) and nonzero surrounding styles (margin, border, padding) in the same tag. This removes differences between browsers.

- Don't use absolute positioning. This removes differences between browsers.

- Use restore-down on the browser and change the window size to test what happens at lower resolutions.

I think this can also be done by flipping the style sheets by javascript so that there will be no restriction of image size.

Thanks to all that replied.
I believe that I have found a way, by using cookies. As I look at it, I will need a start page (its' only function is to query the video resolution and save it as a cookie) then forward to second 'main' page where the cookie is read and then, depending on the results, a CSS corresponding to the resolution will be loaded. The default will be for 1024.
I can do this using javascript and php.
Personally, I dislike entry pages, so the first one will have nothing (no text, no pics, nothing). Maybe this will make the load faster.
Once again, thanks for the replies.
Wayne

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.