0

Hello people, i need a code so when someone join my site, the site resize after the size of the screen on the computer joining.
cause i have seen my site on a small screen and big screen but they look VERY different...
so if the site could resize so it would be same in every screen that join the site, i would be very happy.
please help

3
Contributors
8
Replies
9
Views
8 Years
Discussion Span
Last Post by colweb
0

Well, there isn't a special code for this. It is the way your site is build. If you use fixed sizes for divs or tables than your site will always be the same size no matter what screen you use.
But if you define the with of your divs (and all other elements that have sizes) as ...% it will automatically take the proper size, that is, the size of the screen you are using.

With the size of the screen I mean, the inner-size of the browser window. And when the browser is set to full screen, the site will be adjusted accordingly.

Edited by colweb: n/a

0

Yes. Take a look at the following code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
  <div style="width:600px; height:200px; background-color:yellow;"></div>
  <div style="width:60%; height:200px; background-color:red;"></div>
</body>
</html>

If you resize the browser window, notice that the yellow box stays as it is, but the red one will resize automatically.

1

ok that sounds great
but why is the height not in %
??

We all hate a scrollbar at the bottom of the page (left/right scrolling), but we don't care it there is one on the right site (top/down).
If I remember right, some browsers don't know what to do when you define the height in %. But you can always try, just change the height from 200px to 40%.
Firefox 3 under Linux knows what do and will display the red box properly.

0

in the css file, you should use % width instend of px, like:

width: 90%;

not

width: 900px;

1

in the css file, you should use % width instend of px, like:

width: 90%;

not

width: 900px;

Thanks for repeating my answer. Anything new to say?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.