Tag Archives: standards

If you need to reduce the file size of HTML documents there are a number of element tags that can be removed under certain conditions.

While each tag doesn’t add much to the file size, the total size of all un-necessary tags could add up to a significant amount so omitting them could be worth considering if you’re trying to reduce file sizes to their absolute minimums.

the element is empty or if the first thing inside the head element is an element

head

end

the head element is not immediately followed by a space character or a comment

body

start

the element is empty, or if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a meta, link, script, style, or template element

body

end

the body element is not immediately followed by a comment

li

end

the li element is immediately followed by another li element or if there is no more content in the parent element

dt

end

the dt element is immediately followed by another dt element or a dd element

dd

end

the dd element is immediately followed by another dd element or a dt element, or if there is no more content in the parent element

p

end

the p element is immediately followed by an address, article, aside, blockquote, div, dl, fieldset, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, main, menu, nav, ol, p, pre, section, table, or ul, element, or if there is no more content in the parent element and the parent element is not an a element

rt

end

the rt element is immediately followed by an rt or rp element, or if there is no more content in the parent element

rp

end

the rp element is immediately followed by an rt or rp element, or if there is no more content in the parent element

optgroup

end

the optgroup element is immediately followed by another optgroup element, or if there is no more content in the parent element

option

end

the option element is immediately followed by another option element, or if it is immediately followed by an optgroup element, or if there is no more content in the parent element

colgroup

start

The colgroup element is not empty, and if the first thing inside the colgroup element is a col element, and if the element is not immediately preceded by another colgroup element whose end tag has been omitted.

colgroup

end

the colgroup element is not immediately followed by a space character or a comment

caption

end

the caption element is not immediately followed by a space character or a comment

thead

end

the thead element is immediately followed by a tbody or tfoot element

tbody

start

The tbody element is not empty, and if the first thing inside the tbody element is a tr element, and if the element is not immediately preceded by a tbody, thead, or tfoot element whose end tag has been omitted.

tbody

end

the tbody element is immediately followed by a tbody or tfoot element, or if there is no more content in the parent element

tfoot

end

the tfoot element is immediately followed by a tbody element, or if there is no more content in the parent element

tr

end

the tr element is immediately followed by another tr element, or if there is no more content in the parent element

td

end

the td element is immediately followed by a td or th element, or if there is no more content in the parent element

th

end

the th element is immediately followed by a td or th element, or if there is no more content in the parent element