CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 3rd, 2003, 01:36 PM
kingmike's Avatar
kingmike kingmike is offline
Super Genius
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Orlando, Florida
Posts: 314 kingmike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 7 sec
Reputation Power: 7
Send a message via AIM to kingmike
CSS Positioning Issue with IE

I've been hearing a lot about the benefits of CSS positioning over tables so I decided to give it a try myself.

Below is the code for a template page I whipped up in an attemt to have a two column layout centered directly in the screen. All is well except when I try to view the document using Internet Explorer.

As you can see in this image, Internet Explorer renders an 8 to 10 pixel gap between the two columns. This image shows Mozilla Firebird rendering the page how I expected it to be displayed. To see this in action for yourself, go to http://www.p0w3r.com/test.htm.

The CSS
Code:
/* Tag Redefinitions */
body {
	background-color: #E7E7E7;
}

/* Main Container DIVs */
#leftColumnParent {
	position: absolute;
	left: 0px;
	top: 20px;
	width: 50%;
	text-align: right;
}
#rightColumnParent {
	position: absolute;
	left: 50%;
	top: 20px;
	width: 50%;
}


/* Content Container DIVs */
#rightRow1 {
	position: absolute;
	top: 0px;
	left: 0px;
}
#rightRow2 {
	position: absolute;
	top: 166px;
	left: 0px;
}
#rightRow3 {
	position: absolute;
	top: 333px;
	left: 0px;
}
The Layout
Code:
<div id="leftColumnParent">
  <img src="images/splashLargeBlock.jpg" width="356" height="489" alt="Left Column Data" />
</div>
<div id="rightColumnParent">
  <div id="rightRow1"><img src="images/splashTopBlock.jpg" width="345" height="166" alt="Row One Data" /></div>

  <div id="rightRow2"><img src="images/splashMiddleBlock.jpg" width="345" height="167" alt="Row Two Data" /></div>
  <div id="rightRow3"><img src="images/splashBottomBlock.jpg" width="345" height="156" alt="Row Three Data" /></div>
</div>
__________________
Sleep is highly overrated.

Reply With Quote
  #2  
Old November 3rd, 2003, 02:47 PM
miseria's Avatar
miseria miseria is offline
meep!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: on the good ship lollypop
Posts: 247 miseria User rank is Sergeant Major (2000 - 5000 Reputation Level)miseria User rank is Sergeant Major (2000 - 5000 Reputation Level)miseria User rank is Sergeant Major (2000 - 5000 Reputation Level)miseria User rank is Sergeant Major (2000 - 5000 Reputation Level)miseria User rank is Sergeant Major (2000 - 5000 Reputation Level)miseria User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 8 h 16 m 9 sec
Reputation Power: 25
it works fine on msie if you use:
#rightColumnParent {
position: absolute;
left: 49%;
top: 20px;
width: 50%;
}

relative values are tricky because different browsers interpret them in different ways?

but how about using:

Code:
/* Main Container DIVs */
#contain { position: absolute; width: 100%; height: 100%; }

#leftColumnParent {
	position: relative;
	right: 0px;
	top: 10px;
	width: 50%;
	text-align: right;
}
#rightColumnParent {
	position: absolute;
	left: 50%;
	top: 10px;
	width: 50%;
}


/* Content Container DIVs */
#rightRow1 {
	position: absolute;
	top: 0px;
	left: 0px;
}
#rightRow2 {
	position: absolute;
	top: 166px;
	left: 0px;
}
#rightRow3 {
	position: absolute;
	top: 333px;
	left: 0px;
}
-->
</style></head>

<body>
<div id="contain">
<div id="leftColumnParent">
  <img src="images/splashLargeBlock.jpg" width="356" height="489" alt="Left Column Data" />
</div>
<div id="rightColumnParent">
  <div id="rightRow1"><img src="images/splashTopBlock.jpg" width="345" height="166" alt="Row One Data" /></div>
  <div id="rightRow2"><img src="images/splashMiddleBlock.jpg" width="345" height="167" alt="Row Two Data" /></div>
  <div id="rightRow3"><img src="images/splashBottomBlock.jpg" width="345" height="156" alt="Row Three Data" /></div>
</div>


checked in msie and netscape and it worked. don't have mozilla installed though

Last edited by miseria : November 3rd, 2003 at 02:50 PM.

Reply With Quote
  #3  
Old November 3rd, 2003, 03:14 PM
Darkside's Avatar
Darkside Darkside is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 35 Darkside User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Cool

you can also play with
padding: 0px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;

these should help remove the gaps in ie

Reply With Quote
  #4  
Old November 4th, 2003, 02:48 PM
kingmike's Avatar
kingmike kingmike is offline
Super Genius
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Orlando, Florida
Posts: 314 kingmike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 7 sec
Reputation Power: 7
Send a message via AIM to kingmike
Thanks a lot guys. It works great now.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS Positioning Issue with IE


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway