Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have a potential problem with that layout - what if your <code>H1</code> is too long and so are the buttons? They will run in to each other. Because of this, no simple CSS will do - CSS doesn't do magic like that - it would have to imply some sort of solution to the above problem.</p> <p>However, what you want can simply be accomplished using absolute positioning:</p> <pre><code>&lt;div style="position: relative;"&gt; &lt;h1 style="position: absolute; left: 0; top: 0"&gt;What a great title&lt;/h1&gt; &lt;div style="position: absolute; right: 0; top: 0; text-align: right"&gt; &lt;a href="javascript: void(0)"&gt;This link can kill you&lt;/a&gt; &lt;a href="javascript: void(0)"&gt;Click if you dare&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>If you are really afraid that the header and the anchor container might run in to each other depending on generated content, you can use CSS <code>max-width</code> and <code>overflow</code> properties to restrict their containing boxes to some sensible values. The overflowing content will be hidden but at least the layout will not break visually. I assume the following modification of the above code (pardon the duplicate) would serve the purpose:</p> <pre><code>&lt;div style="position: relative;"&gt; &lt;h1 style="position: absolute; left: 0; top: 0; max-width: 50%; overflow: hidden"&gt;What a great title&lt;/h1&gt; &lt;div style="position: absolute; right: 0; top: 0; text-align: right; max-width: 50%; overflow: hidden"&gt; &lt;a href="javascript: void(0)"&gt;This link can kill you&lt;/a&gt; &lt;a href="javascript: void(0)"&gt;Click if you dare&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>To round off, you <em>cannot</em> achieve this using a straightforward CSS property combination, because with CSS (and HTML), content flows from left to right and top to bottom, or it becomes absolutely- or fixed- positioned which interrupts the flow. Anyhow, it does not want to remain on the same line, and you as the layout designer are left with resolving ambiguities such layout would introduce, such as what to do when the two trains running from each direction front-collide with each other :-)</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