HTML & CSS Quick Reference
A printable HTML and CSS reference covering common tags, selectors, box model, flexbox, grid, and essential properties. Compact and desk-friendly.
HTML & CSS Quick Reference
printablepolly.com
HTML
Text & Headings
<h1>-<h6>Headings (largest to smallest)<p>Paragraph<strong>Bold / important text<em>Italic / emphasized text<br>Line break<hr>Horizontal rule<blockquote>Block quotation<code>Inline code<pre>Preformatted textLists & Links
<ul>Unordered list<ol>Ordered list<li>List item<a href="">Hyperlink<img src="" alt="">ImageTables
<table>Table container<thead> / <tbody>Header / body groups<tr>Table row<th> / <td>Header cell / data cellForms
<form>Form container<input type="">Input (text, email, password, ...)<textarea>Multi-line text input<select> / <option>Dropdown select<button>Clickable button<label>Label for inputSemantic Elements
<header>Page/section header<nav>Navigation links<main>Main content<section>Thematic section<article>Self-contained content<aside>Sidebar content<footer>Page/section footerCSS
Selectors
elementdiv, p, h1.class.card, .btn#id#header, #mainparent childdiv p (descendant)parent > childul > li (direct):hover, :focusPseudo-classes::before, ::afterPseudo-elementsBox Model
marginOutside spacingpaddingInside spacingborder1px solid #cccwidth / heightpx, %, rem, vh/vwbox-sizingborder-box | content-boxFlexbox
display: flexEnable flex containerflex-directionrow | columnjustify-contentcenter | space-between | flex-startalign-itemscenter | stretch | flex-startgapSpacing between itemsflex-wrapnowrap | wrapflex: 1Grow to fill spaceGrid
display: gridEnable grid containergrid-template-columnsrepeat(3, 1fr)grid-template-rowsauto | fr | pxgrid-gap / gapRow and column gapgrid-columnspan 2 | 1 / 3place-itemscenter (align both axes)Common Properties
colorText colorbackgroundcolor | image | gradientfont-sizepx | rem | em | %font-weight400 (normal) | 700 (bold)text-alignleft | center | rightborder-radiusRounded cornerspositionrelative | absolute | fixed | stickyz-indexStack order (higher = on top)overflowhidden | scroll | autotransitionproperty duration easingRelated Templates
FAQ
What is the difference between div and semantic HTML elements?
A <div> is a generic container with no inherent meaning. Semantic elements like <header>, <nav>, <main>, and <article> describe their content's purpose. Using semantic HTML improves accessibility, SEO, and code readability.
When should I use Flexbox vs Grid in CSS?
Use Flexbox for one-dimensional layouts (row OR column) like navigation bars or card rows. Use Grid for two-dimensional layouts where you need control over both rows and columns simultaneously, like page layouts or complex card grids.
What units should I use for font sizes and spacing?
Use rem for font sizes (scales with user preferences), px for borders and small fixed elements, and em or rem for padding/margin. Use vh/vw for viewport-relative sizing. Avoid px for font sizes as it ignores user accessibility settings.