Limitations
htmlbag deliberately does not implement parts of HTML/CSS that would require fundamentally different layout machinery. This page lists what’s missing and where the line is.
Side floats
CSS float: left | right places a float beside the text, which wraps
around it. It does not do everything a browser does yet
(htmlbag#16):
- A float without a
widthshrinks to its longest line. One that holds a block image, a rule, or a table inside a border is set at the full measure instead, and the text after it goes below it. - A float floats as a child of a block container and at the start of
a paragraph, as in
<p><img style="float: left"> text</p>. One later in the paragraph, such as<p>text <img style="float: left"> more text</p>, inside a link, in a list item, or in a paragraph with a border or padding of its own is set inline. - A float at the start of a paragraph stands at the edge of the paragraph’s container, so a side margin of the paragraph is outside it.
- A float that leaves the text no room beside the floats already there goes below the one that ends first, as in a browser, but the text after it goes below with it instead of staying beside the floats above.
- Where a negative margin lets text run over a float, the float
covers the text; a browser paints the text on top. A negative
margin-topdoes not raise a float. - A float is not split across pages. One that does not fit moves to the next page with the text beside it; one taller than a whole page runs past the bottom of the page it starts on.
Multi-column layout
CSS column-count is supported, with column-gap, column-span,
column-fill and column-rule (see CSS properties).
It has these limits:
- Columns are laid out on
body, or on a direct child ofbodywithout a border, a background or padding, whose siblings then span the columns. On any other element the content is set in one column, with a warning. column-widthis not read;columnstakes only the count.solidis the onlycolumn-rule-stylethat is drawn.- Floats and footnotes inside an element with
column-span: allare placed at the foot of the page, and the columns below do not make room for them. - With
column-fill: balance, a row whose content starts in its last column stays full.
Running headers and footers from body content
CSS running() / element() (GCPM) are supported: an element
with position: running(name) is captured out of the flow and a page
margin box places it with content: element(name). See
CSS support. The related string-set property (copying just a
text string instead of an element) is not implemented; use a running
element instead.
Page master alternation
The pseudo-class page selectors @page :first, :right and :left
are supported: size, margin / margin-{top,right,bottom,left},
background-color and background-image resolve per page and cascade
over the generic @page rule. See CSS support. @page :blank
is not implemented.
When a later page’s @page rule gives a different content width
(a different left or right margin), running text, a paragraph that runs
over the page break and a table are set again at the new width. A few things keep the width of the page they started on: a block
with a border or background that runs over the page break, a paragraph
or block inside another block that runs over it, the rest of a table
row split at the break, and absolutely positioned blocks.
Static-typing-mode XPath
Internal — only relevant if you embed htmlbag’s XPath usage. The
underlying goxpath engine implements XPath 1.0 / 2.0 basic
semantics; XPath 2.0 strict static-typing mode (XPST0005 errors for
empty-by-construction expressions) is not enforced.
What this means in practice
A document with figures, tables, lists, footnotes, top and bottom
floats, side floats, running headers and footers, and different
:first, :left and :right pages is covered, in one column or in
columns across the body. Columns inside a box of their own are not.