Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fixing the position of elements 1

Status
Not open for further replies.

blues77

Programmer
Jun 11, 2002
230
CA
I was wondering how pages like are able to maintain the positions of the elements when the window is resized?? any help is greatly appreciated!

thanks
 
you define the height and width of tables and cells or your containers. Did you know that by specifying the height and width of all of the tables and cells, images etc in your page helps it load faster. It also stops the page from dancing around as its loading
 
what unit(s) do you recommend i use for the height and width? should i use % or px. If i use % it will still resize the div tags and tables i have depending on the the size on the window. What i would like is to have everything stay the same size and when the user shrinks the window only a potion of the html page can be seen (just like tek-tips works) I appreciate the help

thanks
mike
 
Hi Mike,

DON'T use %.
You have to use px.

Try this example:

<html>
<head>
<style>
.div1 {
border: solid 3px black;
position: absolute;
top: 10px;
left: 10px;
width: 200px;
height: 200px;
}
.div2 {
border: solid 3px red;
position: absolute;
top: 220px;
left: 220px;
width: 200px;
height: 200px;
}
.div3 {
border: solid 3px lightblue;
position: absolute;
top: 430px;
left: 430px;
width: 200px;
height: 200px;
}
</style>

</head>
<body>
<div class=&quot;div1&quot;>Div example 1</div>
<div class=&quot;div2&quot;>Div example 2</div>
<div class=&quot;div3&quot;>Div example 3</div>

</body>
</html>
<!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top