WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > CSS > resizing issue

Reply
  Thread Tools Display Modes
Old 23rd January 07, 03:33 PM   #1
mattrd
WLC Member
 
Join Date: Oct 2006
Posts: 20
Default resizing issue

okay I don't know what i'm doing wrong, but I can't seem to get this to work the way i want it to. I have 5 divs all floating left so they are next to one another in a line. there is top_right, top_spacer, top_middle, top_spacer, and top_right. What I want to happen is when you change the window size, I want the spacer to allow the nave to stretch as big as the screen and likewise when you shrink it, but it's just not working. go to the page and you'll see what I mean. What am I doing wrong, and can anyone help me??

http://www.matthewrdaniels.com/resize.html

here's the code.

<div id="container">
<div id="top">
<div id="top_left"></div>
<div id="top_spacer"></div>
<div id="top_middle"></div>
<div id="top_spacer"></div>
<div id="top_right"></div>
</div>
</div>

here's the css


container {
width:100%;
height:auto;
margin:0 auto;
}

#top_left {
width:18px;
height:56px;
background-image:url(../images/top_left.gif);
background-repeat:no-repeat;
float:left;
}

#top_middle {
width:521px;
height:56px;
background-image:url(../images/top_middle.gif);
background-repeat:no-repeat;
float:left;
}

#top_right {
width:22px;
height:56px;
background-image:url(../images/top_right.gif);
background-repeat:no-repeat;
float:left;
}

#top_spacer {
width:25%;
height:56px;
background-image:url(../images/top_spacer.gif);
background-repeat:repeat-x;
float:left;
}

#top {
width:100%;
height:56px;

}

thanks!
mattrd is offline   Reply With Quote
Old 24th January 07, 05:15 PM   #2
Oreo
WLC Member
 
Oreo's Avatar
 
Join Date: Jan 2007
Location: Québec, Canada
Posts: 35
Default Re: resizing issue

Hi mattrd,

I spent quite some time trying to figure out how to make this work with float set on the divs. No success. You need to first position the container to a relative position and then set positioning of the 3 divs (left, center, right) on absolute.

Here it is, I hope this is what you are looking for.

Code:
#container {
	position:relative;
	margin:0px auto; 
	width: 100%; 
	height: auto; 
}

#top_left {
	position:absolute;
	left:1%; 
	top:15px;
	background: url('../images/top_spacer.gif') repeat-x top left; 
	width: 50%; 
	height: 56px;
}

#top_middle {
	position:absolute; 
	top:15px; 
	left:50%; 
	margin-left:-260px; 
	z-index:10;
	background: url('../images/top_middle.gif') no-repeat top left; 
	width: 521px;  
	height: 56px;
}

#top_right {
	position:absolute;
	right:1%; 
	top:15px; 
	background: url('../images/top_spacer.gif') repeat-x top left; 
	width: 50%;
	height: 56px
}

#top {
	width: 100%; 
	height: 56px
}

.left {
	float: left
}

.right {
	float: right;
	
}

Last edited by Oreo; 24th January 07 at 05:28 PM.
Oreo is offline   Reply With Quote
Old 25th January 07, 02:14 PM   #3
mattrd
WLC Member
 
Join Date: Oct 2006
Posts: 20
Default Re: resizing issue

wow. it works beautifully!! but what are the .left and .right classes for? the float left and float right? are they the images that are supposed to be on each end? i'll try to see if i can get them in. thanks!
mattrd is offline   Reply With Quote
Old 25th January 07, 02:57 PM   #4
mattrd
WLC Member
 
Join Date: Oct 2006
Posts: 20
Default Re: resizing issue

heyj ust want to let you know i got it all working. thank you SO much for your help
mattrd is offline   Reply With Quote
Old 25th January 07, 04:47 PM   #5
Oreo
WLC Member
 
Oreo's Avatar
 
Join Date: Jan 2007
Location: Québec, Canada
Posts: 35
Default Re: resizing issue

No problem.

As for the 2 classes (.left, .right), they were not really part of the "liquid" structure as they are only helping to position the images within both ends divs. Nevertheless, the class for the right side enabled me to reposition (top:14px) the image so it would match vertically with the line made with the spacer.

Eventhough the layout moves quite nicely as you resize the browser,
I thought that the right part was collapsing a little bit before the one on the left. That is just an illusion created by the drop shadow of the center part that pushes the box to the left (in the image).
Oreo is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox has issue with margins?????? graphicd00d Browser Compatibility 7 1st May 07 05:48 PM
help with a text resizing issue johnnyblotter CSS 1 4th December 06 09:42 PM
IE6 centering issue with nested footer timgrayphoto CSS 1 10th November 06 05:50 PM
Need Help, IE 7 (Resize Window Issue) Shane.Perran Browser Compatibility 2 6th October 06 11:55 AM
Float Issue A.Fairhead CSS 4 15th September 06 01:57 PM


All times are GMT. The time now is 01:30 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyright© 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.