colgroup ... ⁄colgroup syntax
Syntax colgroup
- start tag: <colgroup>
- required: if the element is empty
- may be omitted: if not preceded by a colgroup element whose closing tag is absent AND if the first thing inside colgroup element is the col element - end tag: <⁄colgroup>
- may be omitted: when "is not immediately followed by a space character or a comment" according to web standards
Examples colgroup syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!doctype html> <> <> <>...</> </> <> <> <>... ... </> </> </> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!doctype html> <> <> <>...</> </> <> <> ... </> ... </> </> </> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!doctype html> <> <> <>...</> </> <> <> <>...</> ... </> </> </> |
Video demonstration colgroup element, syntax
HTML5 colgroup element, syntax Tutorial
min | video details |
---|---|
00:05 | video tutorial: colgroup element, syntax |
00:09 | adding colgroup element in page |
00:16 | colgroup element has: - a start tag: <colgroup> - and an end tag: <⁄colgroup> |
00:23 | both tags (start tag, end tag) may be omitted in some cases |
00:25 | start tag <colgroup>: can't be omitted if the element is empty |
00:27 | start tag absent, the element is empty → this is wrong |
00:32 | adding span attribute on it |
00:34 | colgroup element is still empty |
00:40 | start tag absent, the element is empty, span attribute unattached to start tag → this is wrong |
00:46 | nesting col elements inside colgroup element |
00:49 | colgroup element is no longer empty |
00:52 | start tag absent, the element is NOT empty → this is correct |
01:03 | since <colgroup> start tag is absent and there's a colgroup element with a missing end tag <⁄colgroup> right above → 1 colgroup element with 4 columns instead of 2 colgroup elements with 2 columns each |
01:12 | if you want 2 colgroup elements with 2 columns each, and the start tag of the 2nd colgroup absent, make sure the end tag <⁄colgroup> of the 1st colgroup element is PRESENT |
01:20 | according to web standards, end tag <⁄colgroup> may be omitted: when the element "is not immediately followed by a space character or a comment" |