Note that there are some explanatory texts on larger screens.

plurals
  1. POCentering the nested divs and table header design
    primarykey
    data
    text
    <p>I am a newbie when it comes to CSS, can anyone help me with centering a 3-level divs? The thing is the width is unknown since I am using %. I've already tried <code>margin: auto;</code> but didn't work.</p> <p>And am also facing another problem with table headers and footers. I've tried putting up a horizontal line with <code>&lt;hr&gt;</code> code in the <code>&lt;thead&gt;</code> and <code>&lt;tbody&gt;</code> but they didn't appear the wait I want them to be. I am already lost, please help me.</p> <p><a href="http://jsbin.com/ebozar/1" rel="nofollow">Click here to view my current code on jsbin</a></p> <pre><code>&lt;div style="overflow: auto; height: 100%;padding:1% 0% 0% 0.5%;margin:0 auto;border-bottom-left-radius:5px;border-bottom-right-radius:5px;background: #E0E0E0 !important;border: 1px solid #808080;"&gt; &lt;div style="width:45%;margin: 0 1.5%;float:left;"&gt; &lt;div style="width: 100%;text-align: right !important;white-space: nowrap;"&gt; &lt;b&gt;Select&lt;/b&gt; &amp;nbsp; &lt;select name="department" id="department" class="required" style="margin-top:0.4%; margin-right: -4px; width: 70%;"&gt; &lt;option class="options" value=""&gt;Please select&lt;/option&gt; &lt;option class="options" value="1"&gt;Option 1&lt;/option&gt; &lt;option class="options" value="2"&gt;Option 2&lt;/option&gt; &lt;option class="options" value="3"&gt;Option 3&lt;/option&gt; &lt;option class="options" value="4"&gt;Option 4&lt;/option&gt; &lt;option class="options" value="5"&gt;Option 5&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div style="margin-top: 10px !important;margin-bottom: -100px !important;height: 220px;width: 100%;background: #BFBABA !important;border-radius: 5px;border: 4px solid #BFBABA" &gt; &lt;div class="taskhead" style="margin-bottom: -90px !important;padding: 5px;background-color: #ccffff;height: 200px;margin: auto;border-radius: 5px;border: 1px solid #808080;"&gt; &lt;div style="margin: 0px auto!important;padding: 5px;height: 180px; background: #ffffff !important;border: 1px solid #808080;border-radius: 5px;"&gt; &lt;b&gt;Name:&lt;/b&gt; &lt;div id="er_users" style="width: 100%;overflow: scroll; overflow-x: hidden; height: 160px; background: #ffffff !important;"&gt; &lt;table id="uid" style="width: 100%;margin-left: 5px; float: right;"&gt; &lt;thead style="background-color: #e0e0e0"&gt;&lt;hr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td&gt;Name 1&lt;/td&gt; &lt;/tr&gt; &lt;tr class="even"&gt; &lt;td&gt;Name 1&lt;/td&gt; &lt;/tr&gt; &lt;tr class="odd"&gt; &lt;td&gt;Name 2&lt;/td&gt; &lt;/tr&gt; &lt;tr class="even"&gt; &lt;td&gt;Name 2&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;tfoot style="background-color: #e0e0e0"&gt;&lt;hr&gt;&lt;/tfoot&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div style="margin: 0 1.5%; background-color: #D6D2D2 !important;width:0.2%;height: 265px !important;float:left;"&gt;&amp;nbsp;&lt;br/&gt;&lt;/div&gt; &lt;div style="width:45%;margin: 0 1%;float:left;"&gt; &lt;div style="margin-top: 1%"&gt;&lt;/div&gt; &lt;b&gt;User&lt;/b&gt; &lt;div style="margin-top: 10px !important;margin-bottom: -100px !important;height: 220px;width: 100%;background: #BFBABA !important;border-radius: 5px;border: 4px solid #BFBABA;" &gt; &lt;div style="margin-bottom: -100px !important;padding: 5px;background-color: #e6f0a3;height: 200px;border-radius: 5px;border: 1px solid #808080;"&gt; &lt;div style="margin: 0px auto!important;padding: 5px;height: 180px; background: #ffffff !important;border: 1px solid #808080;border-radius: 5px;"&gt; &lt;b&gt;Name:&lt;/b&gt; &lt;div style="width: 100%; overflow: scroll; overflow-x: hidden; height: 160px; background: #ffffff !important;"&gt; &lt;table id="uid" style="width: 100%;margin-left: 5px; float: right;"&gt; &lt;thead style="background-color: #e0e0e0"&gt;&lt;hr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td&gt;Name 1&lt;/td&gt; &lt;/tr&gt; &lt;tr class="even"&gt; &lt;td&gt;Name 1&lt;/td&gt; &lt;/tr&gt; &lt;tr class="odd"&gt; &lt;td&gt;Name 2&lt;/td&gt; &lt;/tr&gt; &lt;tr class="even"&gt; &lt;td&gt;Name 2&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;tfoot style="background-color: #e0e0e0"&gt;&lt;hr&gt;&lt;/tfoot&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p></p> <p>This is the way my table should look like</p> <p><a href="http://oi50.tinypic.com/k9as6s.jpg" rel="nofollow">Click here to view the image</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.
 

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