954,606 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Not changing layout

Hello everyone,

I made a layout using float:left and it's ok until the browser window is resized. When window is resized everything messes up, how to fix it??? how to make it independent from window size? I mean whatever the window size is, layout keep it's positions.

Here is what I have:

body{
	margin: 1% 12% 1% 12%;
	
	border: 1px solid red;
}

div.header{
	float: left;
	
	padding: 7px;
	width: 98.5%;
	
	margin: 3px 0px 20px 0px;

	border: 1px solid red;
}

div.leftSpace{
	float: left;
	
	padding: 10px;
	width: 200px;
	margin: 0px 20px 20px 3px;
	
	border: 1px solid red;
}

div.content{
	float: left;
	
	padding: 10px;
	width: 50%;
	margin: 0px 20px 20px 0px;
	
	border: 1px solid red;
}

div.rightSpace{
	float: left;
	
	width: 170px;
	margin: 0px 3px 20px 0px;
	padding: 10px;
	
	border: 1px solid red;
}

div.footer{
	float: left;
	
	padding: 7px;
	width: 98.5%;
	margin: 0px;

	border: 1px solid red;
}


and the html:

<div class="header">
</div>

<div class="leftSpace">
</div>

<div class="content">
</div>
	
<div class="rightSpace">
</div>
	
<div class="footer">
</div>
Acute
Junior Poster
129 posts since Mar 2009
Reputation Points: 8
Solved Threads: 3
 

I know very little and I am just trying to give back to the forum. With that said, maybe its because you have % as your sizes instead of px and it causes it to resize do the window size? I'm just making a logical guess, the % for the widths and margins are read by browsers to match the window size so it keeps changing when you resize the window.

skald89
Junior Poster
104 posts since Oct 2008
Reputation Points: 12
Solved Threads: 4
 

Thanks for reply.
Even when I put pxs instead of %s, I face the same problem: "float:left"s cannot fit in their places and they just jump under. I've read this http://www.maxdesign.com.au/articles/liquid/ so far, and tried to apply the liquid-fixed method, but problems begin when I use three columns :( I desperately need help :/

Acute
Junior Poster
129 posts since Mar 2009
Reputation Points: 8
Solved Threads: 3
 

oh maybe try changing the width of the divs to auto. That way its width will expand with the content instead of being a fixed width which causes overflow to jump to the next line.

skald89
Junior Poster
104 posts since Oct 2008
Reputation Points: 12
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: