Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a good case for CSS positioning. Elements with <code>position:absolute</code> are positioned relative to their closest <em>positioned</em> parent. That means we can anchor the labels to the top/left of their containers using <code>position:relative</code> on the <code>&lt;ol&gt;</code>, and <code>position:absolute</code> on the label.</p> <p>Example here: <a href="http://jsfiddle.net/YhQYS/1/" rel="nofollow">http://jsfiddle.net/YhQYS/1/</a></p> <p><strong>HTML</strong>:</p> <pre><code>&lt;form action="." method="post"&gt; &lt;ol&gt; &lt;li class="recent-data"&gt; &lt;strong&gt;Recent data&lt;/strong&gt; &lt;ol&gt; &lt;li&gt;3 99&lt;/li&gt; &lt;li&gt;5 98&lt;/li&gt; &lt;li&gt;15 97&lt;/li&gt; &lt;li&gt;28 96&lt;/li&gt; &lt;/ol&gt; &lt;/li&gt; &lt;li class="new-data"&gt; &lt;label&gt;New data&lt;/label&gt; &lt;textarea placeholder="30 95" rows="4"&gt;&lt;/textarea&gt; &lt;/li&gt; &lt;/ol&gt; &lt;/form&gt; </code></pre> <p><strong>CSS</strong>:</p> <pre><code>form &gt; ol { background: #98c8dc; font-family: serif; } .recent-data &gt; ol, .new-data &gt; ol { list-style: none; padding: 5px 10px 5px 0; line-height:20px; } .recent-data li { padding-left:5px; } .recent-data, .new-data { position:relative; padding-left:140px; } .recent-data strong, .new-data label { position:absolute; left:10px; line-height:20px; } .recent-data strong { bottom:5px; } .new-data label { top:5px; } .new-data textarea { font-family:serif; font-size:100%; padding:4px; } </code></pre> <p>This is very simple to reason about, and reliable cross-browser. Note that you shouldn't use a <code>&lt;label&gt;</code> that doesn't have a correspondent form control.</p> <hr> <p><strong>But</strong> that stuff looks like tabular data... it's your choice, we don't have enough context to know what mark-up is more appropriate. So here is a more semantically correct approach using tables, <code>rowspan</code> and <code>vertical-align</code>:</p> <p><strong>HTML</strong>:</p> <pre><code>&lt;form action="." method="post"&gt; &lt;table id="results"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th rowspan="4" scope="row" class="recent-label"&gt;Recent data&lt;/th&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;47&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;3&lt;/td&gt; &lt;td&gt;99&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;5&lt;/td&gt; &lt;td&gt;98&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;5&lt;/td&gt; &lt;td&gt;98&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;th rowspan="1" scope="row" class="new-label"&gt;New data&lt;/th&gt; &lt;td colspan="2" class="new-data"&gt; &lt;textarea&gt;23&lt;/textarea&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p><strong>CSS</strong>:</p> <pre><code>form { background: #98c8dc; font-family: serif; } #results th, #results td { padding:3px 5px; } #results .recent-label { vertical-align:bottom; } #results .new-label { vertical-align:top; } #results .new-data { padding-left:0px; } #results textarea { padding:4px; // +1px border font-size:100%; font-family:serif; } </code></pre> <p>Sample at <a href="http://jsfiddle.net/quqf8/1/" rel="nofollow">http://jsfiddle.net/quqf8/1/</a></p>
    singulars
    1. This table or related slice is empty.
    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.
    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