Can anyone explain rowspan
and colspan
, col
and colgroup
? And are these W3C valid and semantically correct? Under which circumstances are these useful?
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- jQuery hover to slide?
- Issue with star rating css
colspan
rowspan
w3c
as you see, this is for connecting table-cells - and because this is sometimes neccessary, it's valid (RegDwights links will give more information...).
col/colgroup
colgroup
andcol
are used to set attributes to every line in the table (so you don't have to writewidth="80"
for the firsttd
in every line(tr
)):you can also group the cols, lets say the first and second column should get a
with
of 80, the third should get 320:rowspan
andcolspan
are attributes that allow the designer to 'merge' cells - much like the same command in Excel (for example).col
andcolgroup
allow the designer to apply css to a vertical column, rather than having to apply css to individual cells in a column. Without these, this task would be much more difficult as html tables are row-based.All four of these are valid.
For future reference, try http://reference.sitepoint.com/html
Yes, they are all recommended by W3C. Here are direct links to the documentation:
col
colgroup
colspan
rowspan