Jump to content

Two columns using DIV's


phpPunk

Recommended Posts

[quote]<div style="position: absolute; width: 50%; height: 320px; border: 1px solid black">
  <div><img src="" width="340px" height="280px" /></div>
  <div>Map</div> 
</div>
<div style="position: relative; width: 50%; height: 320px; border: 1px solid black; float: right">
  Google AdSense 
</div>[/quote]

<b>This is rendered incorrectly as it's not at the bottom???</b>

This works but all content after this is displayed as though the DIV's don't exist (underneath them?)

What change can I make to correct this issue?
Link to comment
https://forums.phpfreaks.com/topic/30588-two-columns-using-divs/
Share on other sites

[quote author=phpPunk link=topic=118551.msg484517#msg484517 date=1166066387]
[quote]<div style="position: absolute; width: 50%; height: 320px; border: 1px solid black">
  <div><img src="" width="340px" height="280px" /></div>
  <div>Map</div> 
</div>
<div style="position: relative; width: 50%; height: 320px; border: 1px solid black; float: right">
  Google AdSense 
</div>[/quote]

<b>This is rendered incorrectly as it's not at the bottom???</b>

This works but all content after this is displayed as though the DIV's don't exist (underneath them?)

What change can I make to correct this issue?
[/quote]

change either width percentages to 49%, the border is 1px itself on both div's so that takes 1% of the page, causing an overlap.
ah ok, sorry, the reason why the data is being pushed through the div box's is because the box's are set as absolute and relative. So the data just shoves itself to the top. like this:

[code]<div style="width: 50%; height: 320px; border: 1px solid black;">
  <div><img src="" width="340px" height="280px" /></div>
  <div>Map</div>
</div><div style="width: 50%; height: 320px; border: 1px solid black; position:absolute; top:15px; right:10px;">
  <div><img src="" width="340px" height="280px" /></div>
  <div>Map</div>
</div>
<div>
  Google AdSense
</div>[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.