Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no colspan in css as far as I know, but there will be <code>column-span</code> for multi column layout in the near future, but since it is only a draft in CSS3, you can check it in <a href="http://www.w3.org/TR/css3-multicol/#column-span" rel="noreferrer">here</a>. Anyway you can do a workaround using <code>div</code> and <code>span</code> with table-like display like this. </p> <p>This would be the HTML:</p> <pre><code>&lt;div class="table"&gt; &lt;div class="row"&gt; &lt;span class="cell red first"&gt;&lt;/span&gt; &lt;span class="cell blue fill"&gt;&lt;/span&gt; &lt;span class="cell green last"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="table"&gt; &lt;div class="row"&gt; &lt;span class="cell black"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And this would be the css: </p> <pre><code> /* this is to reproduce table-like structure for the sake of table-less layout. */ .table { display:table; table-layout:fixed; width:100px; } .row { display:table-row; height:10px; } .cell { display:table-cell; } /* this is where the colspan tricks works. */ span { width:100%; } /* below is for visual recognition test purposes only. */ .red { background:red; } .blue { background:blue; } .green { background:green; } .black { background:black; } /* this is the benefit of using table display, it is able to set the width of it's child object to fill the rest of the parent width as in table */ .first { width: 20px; } .last { width: 30px; } .fill { width: 100%; } </code></pre> <p>The only reason to use this trick is to gain the benefit of <code>table-layout</code> behaviour, I use it alot if only setting div and span width to certain percentage didn't fullfil our design requirement.</p> <p>But if you don't need to benefit from the <code>table-layout</code> behaviour, then <a href="https://stackoverflow.com/questions/2403990/html-colspan-in-css/2404022#2404022">durilai's answer</a> would suit you enough.</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. 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