Skip to main content

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.

Styled with no class
GroupElements
Texth1 to h6, p, ul, ol, menu, li, dl, dt, dd, blockquote, pre, hr, figure, figcaption, address. Type, color and the space between blocks.
Inline texta, abbr, b, strong, code, kbd, samp, var, mark, small, sub, sup, time, dfn, s, u, del, ins, rt.
Controlsbutton, input, textarea, select, label, fieldset, legend, output, meter, progress. The file and color inputs keep the look of the browser; .luz-input styles them.
Tablestable, caption, tr, th, td. The full width of the container.
Disclosure and dialogdetails, summary, dialog.
Images and mediaimg, picture, video, audio, canvas, svg, iframe, embed, object.
The pagehtml, body. body sets the type, color and background of the page. It has no layout: no container and no centring.
No style
GroupElements
Structurediv, 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 browseroption, 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 shownhead, 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 button with no type, or with type="submit", is the primary action. type="button" and type="reset" are the secondary one.
  • aria-invalid="true" marks a field with an error.
  • disabled marks 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.

ElementCategoryLUZ styleOn this page
aInline textelements/inline.cssLive example
abbrInline textelements/inline.cssLive example
addressPage structureelements/sections.cssLive example
areaImages and mediaNative lookLive example
articlePage structureNative lookLive example
asidePage structureNative lookLive example
audioImages and mediaelements/media.cssLive example
bInline textelements/inline.cssLive example
basePage metadataNative lookMarkup only
bdiInline textNative lookLive example
bdoInline textNative lookLive example
blockquoteText blockselements/text.cssLive example
bodyDocument rootelements/document.cssMarkup only
brInline textNative lookLive example
buttonFormselements/forms.cssLive example
canvasScript and canvaselements/media.cssLive example
captionTableselements/tables.cssLive example
citeInline textNative lookLive example
codeInline textelements/inline.cssLive example
colTablesNative lookLive example
colgroupTablesNative lookLive example
dataInline textNative lookLive example
datalistFormsNative lookLive example
ddText blockselements/text.cssLive example
delTracked editselements/inline.cssLive example
detailsBuilt-in widgetselements/interactive.cssLive example
dfnInline textelements/inline.cssLive example
dialogBuilt-in widgetselements/interactive.cssLive example
divText blocksNative lookLive example
dlText blockselements/text.cssLive example
dtText blockselements/text.cssLive example
emInline textNative lookLive example
embedFrames and embedselements/media.cssLive example
fieldsetFormselements/forms.cssLive example
figcaptionText blockselements/text.cssLive example
figureText blockselements/text.cssLive example
footerPage structureNative lookLive example
formFormsNative lookLive example
geolocationBuilt-in widgetsNative lookMarkup only Experimental
h1Page structureelements/sections.cssLive example
h2Page structureelements/sections.cssLive example
h3Page structureelements/sections.cssLive example
h4Page structureelements/sections.cssLive example
h5Page structureelements/sections.cssLive example
h6Page structureelements/sections.cssLive example
headPage metadataNative lookMarkup only
headerPage structureNative lookLive example
hgroupPage structureNative lookLive example
hrText blockselements/text.cssLive example
htmlDocument rootelements/document.cssMarkup only
iInline textNative lookLive example
iframeFrames and embedselements/media.cssLive example
imgImages and mediaelements/media.cssLive example
inputFormselements/forms.cssLive example
insTracked editselements/inline.cssLive example
kbdInline textelements/inline.cssLive example
labelFormselements/forms.cssLive example
legendFormselements/forms.cssLive example
liText blockselements/text.cssLive example
linkPage metadataNative lookMarkup only
mainPage structureNative lookMarkup only
mapImages and mediaNative lookLive example
markInline textelements/inline.cssLive example
mathSVG and MathMLNative lookLive example
menuText blockselements/text.cssLive example
metaPage metadataNative lookMarkup only
meterFormselements/forms.cssLive example
navPage structureNative lookLive example
noscriptScript and canvasNative lookMarkup only
objectFrames and embedselements/media.cssLive example
olText blockselements/text.cssLive example
optgroupFormsNative lookLive example
optionFormsNative lookLive example
outputFormselements/forms.cssLive example
pText blockselements/text.cssLive example
pictureFrames and embedselements/media.cssLive example
preText blockselements/text.cssLive example
progressFormselements/forms.cssLive example
qInline textNative lookLive example
rpInline textNative lookLive example
rtInline textelements/inline.cssLive example
rubyInline textNative lookLive example
sInline textelements/inline.cssLive example
sampInline textelements/inline.cssLive example
scriptScript and canvasNative lookMarkup only
searchPage structureNative lookLive example
sectionPage structureNative lookLive example
selectFormselements/forms.cssLive example
selectedcontentFormsNative lookMarkup only Experimental
slotWeb ComponentsNative lookLive example
smallInline textelements/inline.cssLive example
sourceFrames and embedsNative lookLive example
spanInline textNative lookLive example
strongInline textelements/inline.cssLive example
stylePage metadataNative lookMarkup only
subInline textelements/inline.cssLive example
summaryBuilt-in widgetselements/interactive.cssLive example
supInline textelements/inline.cssLive example
svgSVG and MathMLelements/media.cssLive example
tableTableselements/tables.cssLive example
tbodyTablesNative lookLive example
tdTableselements/tables.cssLive example
templateWeb ComponentsNative lookLive example
textareaFormselements/forms.cssLive example
tfootTablesNative lookLive example
thTableselements/tables.cssLive example
theadTablesNative lookLive example
timeInline textelements/inline.cssLive example
titlePage metadataNative lookMarkup only
trTableselements/tables.cssLive example
trackImages and mediacomponents/player.css (class)Live example
uInline textelements/inline.cssLive example
ulText blockselements/text.cssLive example
varInline textelements/inline.cssLive example
videoImages and mediaelements/media.cssLive example
wbrInline textNative lookLive 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.

ElementUse insteadWhySource
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.css and change the values. Make it yours shows how.
  • Write your own CSS. CSS with no layer beats every layer of LUZ. You need no !important and no longer selector. What you leave alone stays: if you change only the color of an h1, it keeps the size LUZ gives it.
  • Use LUZ in one region of a page that already has a design. Load luz.conditional.css instead of luz.css, and put data-luz on 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.
CSS
/* 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.

And this is its figcaption.

42 results

6 of 10

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.