plain-site › colour
Every box below is live. Edit the source on the left and the page on the right redraws.
The ↺ reset button puts the source back. Each result is a whole page in an
iframe, so <body> attributes work there without touching this page.
※ Everything here is an HTML attribute or element. The browser converts some of them into style internally (the spec calls them presentational hints). That is the browser's business, not ours: we write no CSS.
bgcolor paints the page, text sets the default text colour,
link / vlink / alink set the colour of unvisited,
visited and active (mouse-down) links. These five attributes are a complete page theme.
<font> is obsolete, but the spec still tells every browser exactly how to
draw it, and the DOM still has HTMLFontElement. A <font>
inside a link overrides the link colour.
The one conforming element that paints a background. It uses the system highlight colours, so it stays readable in dark mode too.
Without CSS, the only way to colour a region is a table, a row or a cell with
bgcolor. This is how every 1998 header bar was made. cellpadding is
the padding, cellspacing the gap.
color, size (thickness), width, align
and noshade (flat instead of grooved).
A tiled background image, as on every GeoCities page. Here the tile is an 8×8 GIF of 66
bytes, inlined as a data URI. background also works on <table>,
<tr> and <td>.
Colour attributes are parsed by the rules for parsing a legacy colour value, a
1990s algorithm still written into the spec. It accepts CSS colour names, #rgb,
#rrggbb, hex without the #, and anything else: non-hex
characters become 0, the string is split into three parts, and each part is
truncated. So every word is a colour. chucknorris is a dark red.
※ Fun, but write real hex codes. A colour should be readable by the next person.
The DOM still carries the Netscape-era properties document.bgColor,
fgColor, linkColor, vlinkColor and
alinkColor. They read and write the <body> attributes, so a
theme switch needs no CSS at all. See night mode for a complete one.
※ Inline onclick is fine for a toy. Real pages attach listeners from a module.
▲ top ・ plain-site ・ next: type