How to Highlight Text With the HTML mark and small Tags
Use mark to highlight relevant text and small for side comments and legal fine print. See default styles, CSS changes and accessibility tips.
73 posts about HTML: questions with answers, tutorials and articles, newest first.
Use mark to highlight relevant text and small for side comments and legal fine print. See default styles, CSS changes and accessibility tips.
HTML is the language that structures every web page. Learn tags, elements and attributes, then build and open your first page in a browser.
em marks stress emphasis and i marks text in an alternate voice. Learn how they differ, how they render, and how to pick the right one.
strong marks important text and b draws attention without importance. Learn how each element works, how they look, and how to choose between them.
Use dangerouslySetInnerHTML with an __html object to render HTML strings in React. Learn why it is risky, how to sanitise input and what to use instead.
The hr element marks a thematic break between blocks of content. Learn its meaning, how to style it with CSS and which old attributes to avoid.
Use the p element for paragraphs and br for line breaks that belong to the content. Learn how whitespace collapses and how to space text with CSS.
HTML data attributes store custom values on any element. See the naming rules, how to read and write them in JavaScript and CSS, and common pitfalls.
A boolean attribute is on when present and off when missing, whatever its value. Learn disabled, checked, required and how to toggle them in JavaScript.
Global attributes can be added to any HTML element. Learn the common ones, from id and class to lang, hidden, tabindex, data-* and popover.
JSX uses className because class is a reserved JavaScript word. Learn how to build dynamic class lists and other renamed attributes.
The id attribute names one unique element and the class attribute groups many. Learn when to use each with CSS, JavaScript and accessibility examples.
Add meta charset utf-8 at the top of head and save your file as UTF-8. See how browsers pick the encoding and how to fix garbled characters.
HTML entities start with an ampersand and end with a semicolon. Learn how to show reserved characters, symbols and non-breaking spaces correctly.
Browsers collapse runs of spaces and line breaks into a single space. See why it happens and how br, pre, nbsp and CSS white-space let you control it.
HTML comments are notes the browser ignores when rendering. Learn the syntax, good uses such as disabling code, and pitfalls like nesting and leaked secrets.
Block elements start on a new line and fill the width, while inline elements flow within text. Learn the differences, examples and how CSS display changes them.
Void elements like br, img, hr and input never have content or an end tag. See the full list, how to write them and why a self-closing div does not work.
The html element is the root of every page, and its lang attribute declares the page language. Learn valid codes, accessibility benefits and how to mark mixed languages.
The html doctype declaration switches the browser into standards mode. See the correct syntax, what quirks mode breaks and how to check which mode a page uses.