Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are right that CSS positioning is the way to go. Here's a quick run down:</p> <p><code>position: relative</code> will layout an element relative to <em>itself.</em> In other words, the elements is laid out in normal flow, then it is removed from normal flow and offset by whatever values you have specified (top, right, bottom, left). It's important to note that because it's removed from flow, other elements around it will not shift with it (use negative margins instead if you want this behaviour).</p> <p>However, you're most likely interested in <code>position: absolute</code> which will position an element relative to a container. By default, the container is the browser window, but if a parent element either has <code>position: relative</code> or <code>position: absolute</code> set on it, then it will act as the parent for positioning coordinates for its children.</p> <p>To demonstrate:</p> <pre><code>&lt;div id="container"&gt; &lt;div id="box"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <pre class="lang-css prettyprint-override"><code>#container { position: relative; } #box { position: absolute; top: 100px; left: 50px; } </code></pre> <p>In that example, the top left corner of <code>#box</code> would be 100px down and 50px left of the top left corner of <code>#container</code>. If <code>#container</code> did not have <code>position: relative</code> set, the coordinates of <code>#box</code> would be relative to the top left corner of the browser view port.</p> <p>Hope that helps.</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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