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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

css layout, works in mozilla, not in IE

Status
Not open for further replies.

NorthStarDA

IS-IT--Management
Mar 16, 2004
614
US
i am trying to create a css layout where i can define the top, bottom,left,right css properties without having to worry about widths and heights. if you look at the code in FF it works fine, in IE the content divs are not sized properly, here is a code sample
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]
<html>
<head>
<style type="text/css">
html, body {
	height: 100%;	
	overflow: auto; 
}

#mainContent {
	position: fixed;
  	overflow: auto;
	border: 1px solid green;
	height:95%;
	width:95%;
}

#contentWindow1 {
	position:absolute;
	top: 20px;
	bottom: 15px;
	left: 15px;
	right: 60%;
	border: 1px solid black;
}

#contentWindow2 {
	position:absolute;
	top: 20px;
	bottom: 15px;
	left: 60%;
	right: 20px;
	border: 1px solid red;
}

</style>
</head>
<body>
<div id="mainContent">

	<div id="contentWindow1">
		Content 1
	</div>
	
	<div id="contentWindow2">
		Content 2
	</div>

</div>
</body>
</html>

how can i make this work in IE?

=========================================
Don't sweat the petty things and don't pet the sweaty things.
 
First, IE does not support [tt]position: fixed;[/tt].

Second, IE does not support setting all four values to position an element. If left and top are set, bottom and right will be ignored. I suggest you rethink your design.
 
i appreciate your response and i understand the problem now but do you have any ideas on how to fix it? I am at a loss as to how to get that kind of control (all 4 values like that) being that i can only set 2 of them.

it seems in IE the only way to do that would be to use javascript to position the windows onload and onresize. Surely there must be a better way?

=========================================
Don't sweat the petty things and don't pet the sweaty things.
 
I personally would go about designing it without the use of any positioning (like left, right, top, bottom) but would rather opt for widths, margins and paddings. Absolute positioning has a bunch of problems with adding (changing) content or printing it. So I would advise on a more fluid design, following regular document flow and using margins and widths.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top