Travis
Travis

Reputation: 2245

CSS Tables Colspan

Alright i am trying not to use HTML tables at all possible now a days. But i am using CSS tables but i am wondering if there is an equivalent of colspan in CSS tables.

I have this code

#fleetTable{display: table;width: 360px;margin: 0 auto;margin-top: 20px;font-size:.875em;float:left;}
    .fleetRow{display: table-row;}
    .fleetCell{display: table-cell;}

And this HTML

<div id="fleetTable">
    <div class="fleetRow textright">
        <div class="fleetCell">Headline</div> <!-- I would like this to span both columns below but be centered -->
    </div>
    <div class="fleetRow textright">
        <div class="fleetCel;">Cell1</div>
        <div class="fleetCell">Cell2</div>
    </div>
</div>  

What selector would you use here to accomplish this?

Upvotes: 0

Views: 2285

Answers (1)

Sachin
Sachin

Reputation: 40990

I am making an obvious assumption that your header will be the first cell of the first row and which having the .fleetCell class. So you can select this first element using :first-child pseudo selector like this.

CSS

.fleetCell:first-child{
   text-align:center;
}

JS Fiddle Example

Upvotes: 1

Related Questions