No name No name - 2 months ago 17
CSS Question

Table cell width uniform

I continue to develop and quest in css.
I want to put the table cells all with the same width, and not like how it appears in jsfiddle. I tried to manually put width to the "th tag" and "td tag" but they are not giving the widths I define.

.tablesorter {
margin: -5px 0 0 0;
table-layout: fixed;
}

.tablesorter td{
margin: 0;
padding: 0;
border-bottom: 1px dotted #ccc;
}

.tablesorter thead tr {
height: 34px;
color:#082B33;;
background:#B5E5EF;
text-align: left;
cursor: pointer;
}


The fiddle link is as follows:
https://jsfiddle.net/4j43fdm1

Answer

Try this

  .tablesorter{
   width:100%;
  }

table tr th, table tr td{
  width:16.6%;
  word-break: break-all;
  }

Click here for demo