Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Something like this:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt; &lt;/script&gt; &lt;style type="text/css"&gt; .super-container { margin: 0 auto; width: 900px; } .table { float: left; margin-bottom: 0.5em; text-indent: 0.2em; padding: 0.1em; width: 100%; } .table-header { font: bold 1.3em tahoma; width: 100%; } .table-description { display: block; font: italic 0.8em tahoma; text-indent: 0.6em; width: 100%; } .field-header { font: bold 1em tahoma; width: 100%; } .field-header, .row { display: block; float: left; padding-top: 0.1em; padding-bottom: 0.1em; width: 100%; } .field-header li, .row li { display: block; float: left; font-size: 1em; height: 1.4em; line-height: 1.4em; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt;&lt;div class="super-container"&gt; &lt;div id="table1" class="table"&gt; &lt;h4 class="table-header" colspan="4"&gt; tbl name &lt;/h4&gt; &lt;span class="table-description" colspan="4"&gt; this is my tbl description &lt;/span&gt; &lt;ul class="field-header"&gt; &lt;li id="a"&gt;A&lt;/li&gt; &lt;li id="b"&gt;B&lt;/li&gt; &lt;li id="c"&gt;C&lt;/li&gt; &lt;li id="d"&gt;D&lt;/li&gt; &lt;/ul&gt; &lt;ul class="row"&gt; &lt;li id="a"&gt;&lt;a href="#"&gt;1a&lt;/a&gt;&lt;/li&gt; &lt;li id="b"&gt;&lt;a href="#"&gt;1b&lt;/a&gt;&lt;/li&gt; &lt;li id="c"&gt;&lt;a href="#"&gt;1c&lt;/a&gt;&lt;/li&gt; &lt;li id="d"&gt;&lt;a href="#"&gt;1d&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class="row"&gt; &lt;li id="a"&gt;&lt;a href="#"&gt;2a&lt;/a&gt;&lt;/li&gt; &lt;li id="b"&gt;&lt;a href="#"&gt;2b&lt;/a&gt;&lt;/li&gt; &lt;li id="c"&gt;&lt;a href="#"&gt;2c&lt;/a&gt;&lt;/li&gt; &lt;li id="d"&gt;&lt;a href="#"&gt;2d&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!-- end table --&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ var widths = { 'a': '20%', 'b': '50%', 'c': '10%', 'd': '10%' } setColumnWidths('#table1', "individually", widths); }); /** * Set column widths of `tableless` table see above example html * @param tbl The id of the table as string * @param how How the function should set the table width as string * @param widths Key value pairs fieldId: value e.g { 'field1': '10px' } */ function setColumnWidths(tbl, how, widths) { var tblRowElements = $(tbl + ' &gt; ul'); var tblColElements = tblRowElements.children(); var numberOfRows = tblRowElements.length; var numberOfCols = tblColElements.length / numberOfRows; switch(how) { case "evenly": tblColElements.width( (100/numberOfCols + "%") ); break; case "individually": var getWidth = function(property) { return widths[property]; } tblColElements.each(function(widths){ var elm = $(this); var elmId = elm.attr('id'); elm.width(getWidth(elmId)); }); break; default: alert("unknown how arg passed: " + how + "\n reverting to default `evenly`"); setColumnWidths(tbl, "evenly"); break; } } &lt;/script&gt; &lt;/div&gt;&lt;/body&gt; &lt;/html&gt; </code></pre>
    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. 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