HTML elements · @luz-ds/core
HTML elements
How LUZ styles each of the 116 current HTML elements, in 14 categories, with a live example and the markup to copy.
The list follows MDN. Deprecated elements are left out on purpose: here is what to use instead.
Most elements are styled with no class. See which ones, and which are left to you, and how to change the defaults.
How to read a card
- Live example. The real element, styled by LUZ right now. Change the color mode in the page footer to check it in all three.
- Markup. The exact code of the example. The copy button copies what you see.
- LUZ note. Whether the element is styled with no class, left to the browser, or has no style because it only groups content. When a class adds something, the note says what.
Rules that style bare elements have zero specificity: any .luz-* class, or a rule of your own, wins.
Which elements have a style with no class
Write the HTML and LUZ styles it, with no class on it. Structure is the exception: the layout of a page is yours.
| Group | Elements |
|---|---|
| Text | h1 to h6, p, ul, ol, menu, li, dl, dt, dd, blockquote, pre, hr, figure, figcaption, address. Type, color and the space between blocks. |
| Inline text | a, abbr, b, strong, code, kbd, samp, var, mark, small, sub, sup, time, dfn, s, u, del, ins, rt. |
| Controls | button, input, textarea, select, label, fieldset, legend, output, meter, progress. The file and color inputs keep the look of the browser; .luz-input styles them. |
| Tables | table, caption, tr, th, td. The full width of the container. |
| Disclosure and dialog | details, summary, dialog. |
| Images and media | img, picture, video, audio, canvas, svg, iframe, embed, object. |
| The page | html, body. body sets the type, color and background of the page. It has no layout: no container and no centring. |
| Group | Elements |
|---|---|
| Structure | div, span, section, article, aside, header, footer, main, search, form, nav, hgroup, col, colgroup. They only group content. Lay them out with the o-* objects, such as .o-stack and .o-grid, or with your own CSS. |
| The look of the browser | option, optgroup, datalist, em, i, cite, q, br, wbr, bdi, bdo, ruby, rp, data, map, area, slot, source, math, thead, tbody, tfoot. LUZ leaves them as the browser draws them. thead, tbody and tfoot only group rows: the rows and cells carry the look of the table. |
| Not shown | head, title, meta, link, style, base, script, noscript, template, selectedcontent, geolocation. They hold information for the browser, not for the reader. |
The one element left, track, is styled by the video player and needs its class.
The HTML says the variant
A class is not needed to tell one look from another when the HTML already says it:
- A
buttonwith notype, or withtype="submit", is the primary action.type="button"andtype="reset"are the secondary one. aria-invalid="true"marks a field with an error.disabledmarks a control that cannot be used.aria-current="page"marks the link of the page you are on.
A class adds what HTML cannot say: a link that looks like a button, the danger and ghost roles, the sizes, and the parts that need markup of their own. The card of each element says what its class adds. An element with a luz-* class takes the look of its component.
All elements, A to Z
Every element, its category and how LUZ styles it. Select a name to open its card.
| Element | Category | LUZ style | On this page |
|---|---|---|---|
a | Inline text | elements/inline.css | Live example |
abbr | Inline text | elements/inline.css | Live example |
address | Page structure | elements/sections.css | Live example |
area | Images and media | Native look | Live example |
article | Page structure | Native look | Live example |
aside | Page structure | Native look | Live example |
audio | Images and media | elements/media.css | Live example |
b | Inline text | elements/inline.css | Live example |
base | Page metadata | Native look | Markup only |
bdi | Inline text | Native look | Live example |
bdo | Inline text | Native look | Live example |
blockquote | Text blocks | elements/text.css | Live example |
body | Document root | elements/document.css | Markup only |
br | Inline text | Native look | Live example |
button | Forms | elements/forms.css | Live example |
canvas | Script and canvas | elements/media.css | Live example |
caption | Tables | elements/tables.css | Live example |
cite | Inline text | Native look | Live example |
code | Inline text | elements/inline.css | Live example |
col | Tables | Native look | Live example |
colgroup | Tables | Native look | Live example |
data | Inline text | Native look | Live example |
datalist | Forms | Native look | Live example |
dd | Text blocks | elements/text.css | Live example |
del | Tracked edits | elements/inline.css | Live example |
details | Built-in widgets | elements/interactive.css | Live example |
dfn | Inline text | elements/inline.css | Live example |
dialog | Built-in widgets | elements/interactive.css | Live example |
div | Text blocks | Native look | Live example |
dl | Text blocks | elements/text.css | Live example |
dt | Text blocks | elements/text.css | Live example |
em | Inline text | Native look | Live example |
embed | Frames and embeds | elements/media.css | Live example |
fieldset | Forms | elements/forms.css | Live example |
figcaption | Text blocks | elements/text.css | Live example |
figure | Text blocks | elements/text.css | Live example |
footer | Page structure | Native look | Live example |
form | Forms | Native look | Live example |
geolocation | Built-in widgets | Native look | Markup only Experimental |
h1 | Page structure | elements/sections.css | Live example |
h2 | Page structure | elements/sections.css | Live example |
h3 | Page structure | elements/sections.css | Live example |
h4 | Page structure | elements/sections.css | Live example |
h5 | Page structure | elements/sections.css | Live example |
h6 | Page structure | elements/sections.css | Live example |
head | Page metadata | Native look | Markup only |
header | Page structure | Native look | Live example |
hgroup | Page structure | Native look | Live example |
hr | Text blocks | elements/text.css | Live example |
html | Document root | elements/document.css | Markup only |
i | Inline text | Native look | Live example |
iframe | Frames and embeds | elements/media.css | Live example |
img | Images and media | elements/media.css | Live example |
input | Forms | elements/forms.css | Live example |
ins | Tracked edits | elements/inline.css | Live example |
kbd | Inline text | elements/inline.css | Live example |
label | Forms | elements/forms.css | Live example |
legend | Forms | elements/forms.css | Live example |
li | Text blocks | elements/text.css | Live example |
link | Page metadata | Native look | Markup only |
main | Page structure | Native look | Markup only |
map | Images and media | Native look | Live example |
mark | Inline text | elements/inline.css | Live example |
math | SVG and MathML | Native look | Live example |
menu | Text blocks | elements/text.css | Live example |
meta | Page metadata | Native look | Markup only |
meter | Forms | elements/forms.css | Live example |
nav | Page structure | Native look | Live example |
noscript | Script and canvas | Native look | Markup only |
object | Frames and embeds | elements/media.css | Live example |
ol | Text blocks | elements/text.css | Live example |
optgroup | Forms | Native look | Live example |
option | Forms | Native look | Live example |
output | Forms | elements/forms.css | Live example |
p | Text blocks | elements/text.css | Live example |
picture | Frames and embeds | elements/media.css | Live example |
pre | Text blocks | elements/text.css | Live example |
progress | Forms | elements/forms.css | Live example |
q | Inline text | Native look | Live example |
rp | Inline text | Native look | Live example |
rt | Inline text | elements/inline.css | Live example |
ruby | Inline text | Native look | Live example |
s | Inline text | elements/inline.css | Live example |
samp | Inline text | elements/inline.css | Live example |
script | Script and canvas | Native look | Markup only |
search | Page structure | Native look | Live example |
section | Page structure | Native look | Live example |
select | Forms | elements/forms.css | Live example |
selectedcontent | Forms | Native look | Markup only Experimental |
slot | Web Components | Native look | Live example |
small | Inline text | elements/inline.css | Live example |
source | Frames and embeds | Native look | Live example |
span | Inline text | Native look | Live example |
strong | Inline text | elements/inline.css | Live example |
style | Page metadata | Native look | Markup only |
sub | Inline text | elements/inline.css | Live example |
summary | Built-in widgets | elements/interactive.css | Live example |
sup | Inline text | elements/inline.css | Live example |
svg | SVG and MathML | elements/media.css | Live example |
table | Tables | elements/tables.css | Live example |
tbody | Tables | Native look | Live example |
td | Tables | elements/tables.css | Live example |
template | Web Components | Native look | Live example |
textarea | Forms | elements/forms.css | Live example |
tfoot | Tables | Native look | Live example |
th | Tables | elements/tables.css | Live example |
thead | Tables | Native look | Live example |
time | Inline text | elements/inline.css | Live example |
title | Page metadata | Native look | Markup only |
tr | Tables | elements/tables.css | Live example |
track | Images and media | components/player.css (class) | Live example |
u | Inline text | elements/inline.css | Live example |
ul | Text blocks | elements/text.css | Live example |
var | Inline text | elements/inline.css | Live example |
video | Images and media | elements/media.css | Live example |
wbr | Inline text | Native look | Live example |
Deprecated elements, and what to use
The 23 elements below are left out of the reference on purpose: they are obsolete or removed, and LUZ styles none of them. Use the replacement.
| Element | Use instead | Why | Source |
|---|---|---|---|
acronym |
abbr |
The same job with the name that stayed. |
|
big |
CSS: font-size, or strong or em when it carries emphasis |
Size is a presentation matter. |
|
center |
CSS: text-align: center for text, margin-inline: auto for a block |
Alignment is a presentation matter. |
|
content |
slot, with Shadow DOM version 1 |
Part of the first Shadow DOM, which browsers removed. |
|
dir |
ul |
A list of files is a list. |
|
fencedframe |
iframe |
A Privacy Sandbox experiment that is deprecated. |
|
font |
CSS: font-family, font-size and color |
Fonts and colors are presentation. |
|
frame |
iframe and CSS, or server-side includes |
Frames split a window into documents; a layout does it with CSS. |
|
frameset |
iframe and CSS, or server-side includes |
As for frame. |
|
image |
img |
Never part of a standard: browsers only kept it for old pages. |
|
marquee |
CSS animation, with prefers-reduced-motion respected |
Moving text that cannot be paused fails WCAG 2.2.2. |
|
menuitem |
A script on the contextmenu event, or a popover with buttons |
The context-menu markup was never implemented widely and was removed. |
|
nobr |
CSS: white-space: nowrap |
Line breaking is a presentation matter. |
|
noembed |
object instead of embed, with fallback content inside |
embed has no fallback of its own. |
|
noframes |
iframe and CSS, or server-side includes |
As for frame. |
|
param |
The data attribute of object, which sets the URL of the resource |
Parameters of a plug-in that no browser runs. |
|
plaintext |
The text/plain type of the response |
It could not be closed: the rest of the page became text. |
|
rb |
The base text directly inside ruby |
The ruby base needs no wrapper. |
|
rtc |
Nested ruby elements |
As for rb. |
|
shadow |
slot, with Shadow DOM version 1 |
Part of the first Shadow DOM, which browsers removed. |
|
strike |
del for an edit, s for text that no longer applies |
The element says what the text means, not how it is drawn. |
|
tt |
code, kbd, samp or var by meaning, or CSS font-family: monospace |
Fixed width is a presentation matter. |
|
xmp |
pre with code, with < and & escaped |
It could not hold its own end tag. |
Changing the default styles
Every rule that styles a bare element has zero specificity, so yours wins without a fight.
- Change the tokens. This is the way to change the look of the whole site: colors, type, space and radius. Copy
themes/_template.cssand change the values. Make it yours shows how. - Write your own CSS. CSS with no layer beats every layer of LUZ. You need no
!importantand no longer selector. What you leave alone stays: if you change only the color of anh1, it keeps the size LUZ gives it. - Use LUZ in one region of a page that already has a design. Load
luz.conditional.cssinstead ofluz.css, and putdata-luzon the element that holds the region. The reset and the bare elements apply only inside it. Which level do I need? says when to choose it.
/* Your CSS has no layer, so it beats every layer of LUZ. */
h1 {
font-weight: 600;
}
button {
border-radius: 0;
}
The tokens, your CSS and the region work together: the tokens change what LUZ draws, your CSS has the last word, and the region limits where LUZ draws at all.
Base elements
elements/*.css
generic/_reset.css
Headings use ET Book
Paragraphs use the system sans, and links use the brand color.
A native disclosure
The details element needs no JavaScript.
Use mark to highlight, and Ctrl K for keys.
Released on .
A bare figure is a padded surface.
Every current HTML element, with a live example, is in the HTML elements reference.
The reset sets border-box sizing, removes default margins, thins scrollbars and collapses motion when reduced motion is requested.