tags:

views:

122

answers:

4

I tried the solution from this thread, but I must be missing something because it doesn't work:

<div style="float:left;margin-right:200px">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

<div style="float:right;width:200px">
<p>navigation</p>
</div>

It works when the text in the content div (the left one) is short, but when it's long then the div takes up the whole width of the browser and the margin is there, but the right div is pushed below the first one nevertheless.

What am I missing?

Edit: The goal is to have a fix sized navigation column on the right of the browser window and the left div should get all the space left by the right navigation column (liquid layout).

A: 

Hey... floating both left. I don't know if I exactly get the gist of what you're trying to do, but from the way you're explaining the problem, I think floating both left will help you achieve your goal. Let me know...

EDIT: Also, you need to define a width for both DIV containers if you want a two column layout to be reliazed. So, in sum... float both LEFT and define widths for each that will stay inside a parent container or viewport (factoring for margins and padding if used)

-Rob

rob - not a robber
I want a fix sized colum on the right of the browser window and the left content column should take up all the available space left, so it should be sized dynamically.
Tom
A: 

What ever you want to float: right; you need to place above the div that needs to be on the left. Now this way you have your width:200px for navigation on the right and your dynamical changing content on the right.

<div style="float:right; width:200px">
<p>navigation</p>
</div>

<div style="margin-right: 200px;">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
Jonathan Czitkovics
The point is to define a 200px navigation column on the right and the left content div should take up all the space left by the nav column (liquid layout)
Tom
@Tom, Ok I will edit when I get the code done. Sorry for the misunderstanding.
Jonathan Czitkovics
It really does seem to work now. Strange the order of the divs is significant.
Tom
A: 

Does this work?

<div id="nav">
<p>navigation</p>
</div>

<div id="main">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

#nav {
    width:200px;
    float:right;
}
#main {
    float:right;
}
Catfish
Not really, because the content in the left area (text or image or anything) should converge to the left and extend to the right if necessary. Your solution aligns both divs to the right.
Tom
A: 

Try this:

<div style="width: 1000px; position: relative;">
  <div style="position: relative; margin-right: 210px;">
     Left column
  </div>
  <div style="width: 200px; margin: 0px; position: absolute; right: 0px; top: 0px;">  
    Right column 
  </div>
</div>
Maciej
The problem with this is that its static and when the window width changes the content and navigation do not follow.
Jonathan Czitkovics
@Jonathan, you can change width:1000px to width: 100%, should work.
Maciej