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

Recommended Answers

All 8 Replies

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.

so if i use 80% instead of 600px it will correct size automatic?

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.

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

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.

that sound good.
i will try it and report back in a few days.

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

width: 90%;

not

width: 900px;

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?

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.