[help] Div size

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

[help] Div size

Post by thiscatis »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


[syntax="css"]
#hiddenfooter {
	border-top:solid 4px  #CCCCCC;
	position: absolute;
	top:8%;
	left: 20%;
	right:20%;
	bottom: 45%;
	background-color: #B28C66; 
	visibility:hidden;
	filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;
	
	}
i'm using this div to pop up as a transparant overlay on my site with some information.
In firefox the size of the width & height is correct, according to the relative percentages.
In IE the div is just as width and high as the text in it... ant solutions?


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

You shouldn't use position top AND bottom and left AND right. Position:absolute is used to give the div it's starting position. If you want to set the height and width you should set the height and width of the div in px, % or em.

If you don't set the height and width specificly they will depend on the content and the margin you give it. the normal behavior of a div is to fill in 100% of the width of the parent element and stretch vertically just far enough to contain it's content.

Maybe what you want to use is margin-left, -right, -top and -bottom?
Post Reply