CSS get total number of elements
by Zsanett Tamás
HTML
<div class="table">
<div class="headers">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</div>
</div>
CSS
.table{
display:table;
width:100%;
}
.headers{
display:table-row;
border:1px solid #ccc;
width:100%;
}
.headers div{
width:20px;
padding:5px;
margin:3px;
border:1px solid #666;
border-radius:4px;
text-align:center;
line-height:20px;
display:table-cell;
}
.headers div:last-child{
width:auto;
}