iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-23-2006, 12:18 PM
WebProWorld Pro
 
Join Date: Feb 2004
Location: England Baby!
Posts: 216
icb01co2 RepRank 0
Default Tableless div problems

Hi All,

I am new to tabless div development and I have a few questions that maybe you can help me with. Ok, first off how do i render a div below a div that has absolute positioning?

For example:

html:

<div class = "top"> /* text */ </div>
<div class = "bottom"> /* bottom text */ </div>

css:

.top
{
position:absolute;
top: 200px;
}


Ok, so I want the bottom div to be rendered underneath the top div. Problem is that it renders it behinf the top div. One way around this would be to set the absolute position of the bottom div to below the top one. Although I will never know how much text is in the top div because the info will come from a dynamic db so i cant give an accurate position to the bottom div.

Second problem I have is when i have two divs side by side like table layout but i want them to both be the same height.

for example if i did this:

<table>
<tr>
<td class = "blue"> This side blue </td>
<td class = "red"> This side red </td>
</tr>
</table>

Ok, so in this situation if i had a load of text in the red td the blue td will also be the same height.

With two divs set at absolute positions next to each other, when the blue side fills up its height will be longer than the red side. Hence it will look lob sided.

I may not be explaining this two well but i hope it makes sense.
Chris.
Reply With Quote
  #2 (permalink)  
Old 07-23-2006, 05:40 PM
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Cornwall, UK
Posts: 972
speed RepRank 1
Default

For question 1 I would not use absolute positioning, but then I never use absolute positioning, instead I would use margin-top: 200px on .top, it should get the same effect depending on the rest of the layout.

I know this doesn't exactly answer your question, but with an unknown amount of text being present within .top it's the method I would/do use.

For question 2 http://alistapart.com/articles/fauxcolumns/ explains it quite well, in truth unless you fix the height, the 2 columns really won't be the same height but they will look it and that is all that matters.
Reply With Quote
  #3 (permalink)  
Old 07-24-2006, 11:10 PM
bj's Avatar
bj bj is offline
WebProWorld 1,000+ Club
 
Join Date: Apr 2005
Location: Delaware Valley, PA
Posts: 1,172
bj RepRank 3bj RepRank 3
Default

Position absolute takes that box out of the flow of the document. This means it will always be on top of whatever else is IN the flow. The flow starts on top and works down. So simply take the position absolute off that div and start your next div- it will automatically go underneath it.

example--
.top {
width: 100%;
}
.bottom {
width: 100%;
}

and the html the same way you showed it.

It's also best cross browser to learn to use float layouts. For info and layouts see Kickass WebGeek CSS Resources.
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:45 PM.



Search Engine Optimization by vBSEO 3.3.0