Welcome to WebmasterWorld Guest from 54.198.237.87

Forum Moderators: not2easy

Message Too Old, No Replies

Can a table cell contain an absolute element?

     
6:09 pm on Oct 21, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:May 31, 2002
posts: 157
votes: 0


I have a three column layout and I am trying to get my absolutely positioned sidebars contained within <td> cells, but they always spill out anyway.

Here's a sample code to show what I mean:

.left-sidebar {
top:177px;
font-size:8pt;
position:absolute;
width:160px;
left:5px;
}

<td><ul class="left-sidebar"></ul></td>

8:20 pm on Oct 21, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 12, 2003
posts:167
votes: 0


I am a real novice at this absolute positioning stuff but with a bit of help from here I did get an absolute positioned left side bar to work, YMMV. I did not put my abs. pos. element in the td tags but just had a div to clear the space. I put the abs. position code at the bottom of the html page as I didn't want the SE to pick up the navigation menu at the top. It was a bit fussy to get the abs. pos. sidebar to center properly.

so:

<table width="100%" border="1" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
<tr class='midrow'><td style="width:17.5%;background:#009999;">
<div id="clearleft">

</div>
</td>
..... rest of the page and at the bottom.
</table>
<div id="leftsidebar">
<?php
include("left_sidebar.inc");
?>
</div>

and for the css:

#clearleft {
width:100%;
height:1400px;
overflow:hidden;
background:#009999;
}

#leftsidebar{
position:absolute;
top:320px;
left:15px;
width:15%;
height:1350px;
background:#009999;
text-align:center;
}

2:07 pm on Oct 22, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:May 31, 2002
posts: 157
votes: 0


I looks like you placed the sidebar outside the table though. Not sure this will work with my setup though.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members