Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Walt,</p> <p>I came up with one solution making minimal changes to the HTML and modifying the CSS. </p> <p>HTML</p> <pre><code>&lt;div class="people"&gt; &lt;div class="head"&gt; &lt;h1 class="title"&gt;Title&lt;/h1&gt; &lt;-- Moved the H1 tag above the controls div &lt;div class="controls"&gt; &lt;button&gt;Delete&lt;/button&gt; &lt;select&gt; &lt;option&gt;Some Option&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;table class="list"&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt;&lt;th&gt;Age&lt;/th&gt;&lt;th&gt;Score&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;John&lt;/td&gt;&lt;td&gt;14&lt;/td&gt;&lt;td&gt;200&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Jack&lt;/td&gt;&lt;td&gt;23&lt;/td&gt;&lt;td&gt;2100&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p></p> <p>CSS</p> <pre><code> .title { display: table-cell; } .controls { display: table-cell; vertical-align: middle; text-align: right; } .head { display: table; width: 100%; padding: 10px; background-color: #F1F1F1; } </code></pre> <p>See this fiddle <a href="http://jsfiddle.net/8xLtM/" rel="nofollow">http://jsfiddle.net/8xLtM/</a></p> <p><strong>UPDATE 1:</strong> Perhaps a better answer if you'd prefer to avoid the display: table markup:</p> <p>To center the controls, its line-height needs to equal the title's font size + line height.</p> <pre><code>.title { overflow:hidden; font-size: 2em; line-height: 2em; } .controls { float: right; line-height: 4em; vertical-align: middle; } </code></pre>
 

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