Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I want to be able to make my whole website bigger and smaller depending on how big screen the user has. I have been searching like for ever for a solution, but there's not much to find.
So, one day I thought I found a solution, and it worked great in my browser, Chrome. The problem know is that I've found out this is not supported in other browsers, tested Firefox and IE 8. How is that?

CSS
This is an example of the code I'm using in the CSS file that is loaded on every page:
@media screen and (max-width: 1300px){
    #html, body {
    zoom: 80%;
    }
}


So then I thought, maybe it's the @media that is not supported. But after some tests I now understand that zoom is the problem. Try these codes in your browsers for testing yourself:
HTML code:
HTML
<html><head>
<link href="test.css" rel="stylesheet" type="text/css" />
</head>
<body>
<img src="urltowhateverpicyouhave.jpg" />
</body></html>


CSS code (test.css):
CSS
#html, body {
	zoom: 50%;
}



What is the problem with other browsers!? I know IE use to be a little strange, but Firefox??

Would really appreciate any help on my problem. Also, any solution wich will make the website bigger or smaller on different screens will be really thankful.

Thanks in advanced :)
Posted

1 solution

I would really advise you to avoid zooming the page using your Web application. I'm not talking about some special cases like re-sampling and panning some image which needs high-fidelity presentation and stuff like that. The scaling of the whole page is becoming a commonplace. Most modern versions of Web browsers implements this feature, including latest IE versions, Seamonkey, Firefox, Chrome, but they do it in very different ways. It's likely that the users want to use this feature.

That said, your goal should be very different. Instead of implementing the zoom and confusing the user (just think about it: the user will see the combination of your application's zoom and browser zoom; why? just to drive a user crazy?), you should develop fluid page design. The page should look recognizable, highly readable, logical, easy locate topic and navigate for the wide range of page sizes in pixels, methods of zoom, zoom levels and fine detail of rendering by all the major browsers. You should not try to make the rendering identical — these days, this is nearly impossible; instead you should meet the practical criteria I tried to list above.

First of all, remember the the main thing is content, not "decorations". The purpose of design is to present the content clearly, not the other way around.

—SA
 
Share this answer
 
Comments
siXor 27-Jan-12 19:08pm    
Okey, then I guess I will have to multiply all pixels with 0.86 or something so that it fits nicely for most screens. Thank you for your answer.
Sergey Alexandrovich Kryukov 27-Jan-12 20:22pm    
You are welcome.
Good luck, call again.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900