Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML+CSS : how to move not close divs to create a right column?
    primarykey
    data
    text
    <p>I have a problem that I thought was pretty simple but that is taking me a lot of time to solve it. If there is a simple solution (and I don't know CSS enough), please point me there and I'll close this question immediately.</p> <p>My problem is the following.</p> <p>I have 6 divs one on top of another, something like:</p> <pre><code>&lt;div id="header"&gt;header content&lt;/div&gt; &lt;div id="sidebar1"&gt;sidebar1 content&lt;/div&gt; &lt;div id="maincontent"&gt;maincontent content&lt;/div&gt; &lt;div id="maincontent2"&gt;maincontent2 content&lt;/div&gt; &lt;div id="sidebar2"&gt;sidebar2 content&lt;/div&gt; &lt;div id="footer"&gt;footer content&lt;/div&gt; </code></pre> <p>What I want to have is something like:</p> <pre><code>----------------------------------------------------------- | header content | ----------------------------------------------------------- -------------------------------------- ------------------- | maincontent content | | sidebar1 content| | | ------------------- | | ------------------- | | | sidebar2 content| | | ------------------- -------------------------------------- -------------------------------------- | maincontent2content | | | | | | | | | -------------------------------------- ----------------------------------------------------------- | footer content | ----------------------------------------------------------- </code></pre> <p>In other words, is there a way to create a right column even if the divs are not one after another using only CSS and without moving the divs in the code?</p> <p>I tried to use for sidebar1 the following css</p> <pre><code> position:absolute; top:3em; right:0; </code></pre> <p>and for sidebar2 the following css</p> <pre><code> position:absolute; top:9.5em; right:0; </code></pre> <p>but I have the impression that this is not the right way to do it.</p> <p>A simple way could be to define the <code>top</code> attribute size as a function of the height of heather, but I couldn't find any way to do it only with CSS.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload