Jump to content

Page height problem


otester

Recommended Posts

I have some curtain/shadowy thing that runs down the sides between the white/orange on my site, but they only work when I set a height %, this however locks the page length which causes problems on a few pages.

 

Is it possible to make the length dynamic but also keep the curtains.

 

Site has a super container, inside that is the left curtain, main container then right curtain.

 

Here is the CSS:

 

	html, html body {
	font-family:arial,helvetica,sans-serif;
	font-size:12px;
	color:#000;
	height:111%;
	background:#F90;
	margin-top:0px;
}

#left_curtain {
	background-image:url(../images/left_curtain.png);
	background-repeat:repeat-y;
	float:left;
	height:inherit;
	width:40px;
}
#right_curtain {
	background-image:url(../images/right_curtain.png);
	background-repeat:repeat-y;
	float:right;
	height:inherit;
	width:40px;
}

 

Any help would be greatly appreciated,

 

Thanks,

 

otester

Link to comment
Share on other sites

Ideally you would want to make the "curtains" a background for the wrapper div and then it will extend down to fit the content.  A background image on repeat will only go as far as the height, if you don't define a height and have nothing in the div (a background image doesn't count as an item in a div) then it won't have any height.  As you add things to the div, the height shrink wraps to fit and then applies whatever background it can.  I would suggest making an image the width of your wrapper and maybe a height of 30px or something, then paint the edges of that image so that when you repeat the image down it appears to be curtains, then just add this as the background image of your wrapper and put in background-repeat: repeat-y;

 

Any reason that wouldn't work?

 

I can't think of any other way to dynamically change the height of an element based on the height of another element, I think you'll have to nest it.

Link to comment
Share on other sites

Ideally you would want to make the "curtains" a background for the wrapper div and then it will extend down to fit the content.  A background image on repeat will only go as far as the height, if you don't define a height and have nothing in the div (a background image doesn't count as an item in a div) then it won't have any height.  As you add things to the div, the height shrink wraps to fit and then applies whatever background it can.  I would suggest making an image the width of your wrapper and maybe a height of 30px or something, then paint the edges of that image so that when you repeat the image down it appears to be curtains, then just add this as the background image of your wrapper and put in background-repeat: repeat-y;

 

Any reason that wouldn't work?

 

I can't think of any other way to dynamically change the height of an element based on the height of another element, I think you'll have to nest it.

 

My current workaround (which seems to work ok) is just setting the height of the curtain divs to the height of the wrapper.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.