HTML & CSSPage Title Cheat Sheet

HTML and CSS fundamentals — HTML elements, semantic tags, CSS selectors, box model, flexbox, grid, and essential web development building blocks.

Last Updated: July 15, 2025

HTML Semantic Elements

ElementPurpose
<header>Page or section header — logo, nav, title
<nav>Primary navigation links
<main>Main content — one per page
<section>Thematic grouping of content
<article>Self-contained content (blog post, card)
<footer>Page or section footer

CSS Selectors

SelectorExampleMatches
Elementp { }All

elements

Class.card { }Elements with class="card"
ID#header { }Element with id="header"
Descendantnav a { }All inside
Childul > li { }Direct
  • children of
    • The Box Model

      LayerProperty
      Contentwidth, height
      Paddingpadding: 10px — space inside border
      Borderborder: 1px solid #000
      Marginmargin: 10px — space outside border

      Flexbox Essentials

      PropertyValues
      display: flexEnables flex on container
      justify-contentcenter, space-between, space-around, flex-start
      align-itemscenter, stretch, flex-start, flex-end
      flex-directionrow (default), column, row-reverse