Skip to content Skip to sidebar Skip to footer

Does Not Apply Class To The Columns Of A Table

My understanding of col is that it may be used to indicate a class for all the elements in a table's column. This doesn't seem to be working for me though. I can apply the class

Solution 1:

According to w3 schools, only the width attribute works in Firefox. It also doesn't look like the border attribute is supported at all.

http://www.w3schools.com/tags/tag_col.asp

Solution 2:

This is because the CSS 2.1 specification defines that the different border properties only apply when you set border-collapse: collapse; on the related <table> element.

Furthermore, according to CSS 2.1 there are only very few properties, that can be used to style columns (with restrictions):

  • border properties (require border-collapse: collapse; on the related <table>element)
  • background properties (only apply if the cell and row background is transparent)
  • width
  • visibility (value collapse avoids rendering of the cells, cells spanning into other columns are clipped)

Solution 3:

You don't have to apply classes to every td.

You can simply style the td's:

td {
  background-color:#b0c4de;
  border-style:solid;
  border-width:5px;
 }

Post a Comment for " Does Not Apply Class To The Columns Of A Table"