Dave's Web Development Quick Reference

Project Management Pipeline

  1. Local Setup

    1. Open Git Bash
    2. Navigate to your projects folder
      cd ~/Projects
    3. Create project folder
      mkdir my-project
    4. Create subfolders
      mkdir assets assets/media assets/fonts
    5. Create Files
      touch index.html styles.css README.md .gitignore
  2. Collect Assets

    1. Move media (background images, logo, videos etc.) to assets/media
    2. Download .woff2 font files to assets/fonts/ and link in CSS using @font-face OR Select Google Fonts and copy the <link> tags directly into HTML <head>.
    3. Write standard HTML boilerplate to index.html
    4. Add CSS Reset & Base Rules to styles.css
  3. Version Control

    1. Configure .gitignore. Add to plaintext file, for now just with OS junk:
      .DS_Store
      Thumbs.db
      .vscode/
    2. Initialize Git & Make Initial Commit
      git init
      git branch -M main
      git add .
      git commit -m "Initial commit: basic HTML/CSS setup"
    3. Create & Link Remote GitHub Repository
      1. On GitHub, click New Repository
      2. Name it my-project to match local folder name.
      3. Leave everything else unchecked (Don't create readme, .gitignore or license again)
      4. Click Create repository
      5. Run the following commands under or push an existing repository from the command line:
        git remote add origin https://github.com/your-username/my-project.git
        git push -u origin main
  4. Deployment

    1. Publish the Live Site.
      1. On the GitHub repopage go to Settings > Pages
      2. Under Build and deployment > Branch set branch to main and folder to / (root).
      3. Click save.
      4. After 1-2 minutes hit refresh to get the live URL
  5. Daily Workflow

    1. Whenever you make changes to the code, follow this loop to update GitHub and the site:
      git add .
      git commit -m "Describe what changed"
      git push

HTML Reference

Standard HTML5 Boilerplate

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
</body>
</html>

Defintions

Term Definition Example
HTML HyperText Markup Language is the code used to structure a webpage and its content.
Element An Element is the basic building block of HTML documents. It generally consists of an opening tag with zero or more attributes, content, and a closing tag. The anatomy of an html element
Opening Tag A Opening Tag consists of an element name surrounded by the greater-than and less-than symbols. It may contain one or more attributes after the element name and before the closing less-than symbol. <section id="Contact Information">
Void Element A Void Element is an element with no content and no closing tag. <img src="https://developer.mozilla.org/en-US/docs/Glossary/Element/anatomy-of-an-html-element.png" alt="The anatomy of an html element">
Closing Tag A Closing Tag follows the content in a non-void element. It consists of the element's opening tag with the name preceded by a forward-slash. </section>
Attribute An Attribute changes the behavior of an HTML element or provides metadata about it. hrf="https://google.com/

Elements

Structure and Metadata

Element Description Attributes
<!DOCTYPE html> A legacy declaration that must come first in every HTML document for compatibility reasons.
<html> The root element of a document which comes directly after the document type declaration. All other elements must be nested within it. global, version, lang
<head> Contains metadata about the document, like it's title, script, and stylesheets global, profile
<link> Specifies relationships between the current document and an external resource like a stylesheet or icons. global, href, rel, type, sizes, media
<meta> A void element which represents metadata not covered by one of the other elements. global, charset, content, media, name
<title> The document title shown in the browser's title bar or a page tab. global
<body> The non-meta content of a page. There can only be one body element in a HTML document. global

Content and Sections

Element Description Attributes
<header> Introductory content, typically including logos, navicational aids, a search form, etc. global
<hgroup> A heading and related content. Useful to keep a subtitle together with a title. global
<nav> A section which provides navigation links, either to parts of the current document, or to other documents on a site. global
<main> The dominant content of the body of a document. global
<section> A generic standalone section of a document which doesn't have any more specific semantic element to represent it. They should always have headings. Use these instead of <div>! global
<article> A self-contained composition which can or could be independent from the rest of the document. global
<aside> A portion of the document whose content is only indirectly related to the main content of the document. global
<h1>,<h2>,<h3>,<h4>,<h5>,<h6> Six levels of section headings. All headings create a block-level box in the layout. There should only be one <h1> element on a page. global
<footer> A closing section typically including copyright information, or information about the author. global
<div> AVOID DIVITIS. It is non-semantic, and does not affect flow or layout. Use it when other semantic elements are inappropriate global
<p> A paragraph of related content. They are block-level elements and will automatically close if another block-level element is parsed before the closing tag. global
<blockquote> Indicates that the enclosed text is an extended quotation, usually rendered visually by indentation. global, cite
<figure> Self-contained content, potentially with a caption. The figure and its caption are referenced as a single unit. global
<figcaption> A child element of <figure> which describes the figure's contents. global
<ul> An unordered list of items, typically rendered as a bulleted list. N.B. don't use deprecated styling attributes. Use CSS properties instead. global
<ol> An ordered list of items, typically rendered as a numbered list. global, reversed, start, type
<li> A child of either <ul>, <ol>, or <menu> containing an individual listed item. global
<img> Embeds an image into the document. Supported formats: APNG, AVIF, GIF, JPEG, PNG, SVG, WebP src, alt, global, height, sizes, width,
<audio> Embeds sound content in documents. src, global, autoplay, controls, loop, muted, preload
<video> Embeds a media player which supports video playback. src, global, autoplay, controls, heigh, width, sizes, loop, muted, poster
<embed> Embeds external content from an external source. src, global, type, height, width

Text semantics

Element Description Attributes
<a> Together with its href attribute, this creates a hyperlink to web pages, files, email addreses, locations in the current page, or anything else a URL can address. global, download, href, rel
<code> Indicates a short fragment of computer code, by default displayed with the user agent's default monospace font. global
<em> Indicates a stressed emphasis compared to surrounding words. Use <cite> for the title of a work, and <i> for some text set off from the rest. global
<cite> The title of a creative work. It may be in an abbreviated form. global
<i> Used for alternative voices, taxonomic designations, idiomatic terms, technical terms, throughts, or ship or vessel names. global
<strong> Indicates importance, seriousness, or urgency. Typically rendered in bold type. global
<dfn> A term to be defined. global
<mark> Indicates marked or highlighted text. global
<q> Indicates an inlie quotation. global, cite
<sub> Specifies inline text to be displayed as a subscript for typographical reasons. global
<sup> Specifies inline text to be displayed as a superscript for typographical reasons. global
<u> Indicates a span of inline text with a non-textual annotation, like annotating spelling errors. global
<b> To draw the reader's attention towards elements which might not otherwise be important. global
<br> A line break. global
<span> A generic inline container for phrasing content. global

Tables

Element Description Attributes
<table> Represents tabular data. global
<thead> Encapsulates a set of table rows comprising the head of the table with information about the columns. global
<tbody> Encapsulates a set of table rows comprising the table's main data. global
<tfoot> Encapsulates a set of table rows comprising the foot of the table with information about the columns. global
<tr> Defines a row of cells in a table. These can then be described as children with either data or header cells. global
<th> A header cell which is a child of a <tr> element. global, abbr, colspan, headers, rowspan, scope
<td> A data cell which is a child of a <tr> element. global, colspan, headers, rowspan
<caption> The caption or title of a table. global

CSS Reference

CSS Reset Boilerplate


/* 1. Predictable sizing model for everything */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 2. Responsive media defaults (no giant images or layout overflow) */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 3. Smooth scrolling and text size preservation */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* 4. Custom properties */
:root {
/* 4a. Spatial rhythm: power-of-two or 4px/8px scale */
--space-xs: 0.5rem; /* 8px */
--space-sm: 1rem; /* 16px */
--space-md: 1.5rem; /* 24px */
--space-lg: 2.5rem; /* 40px */

/* 4b. Palette */
--color-surface: #ffffff;
--color-canvas: #f8fafc;
--color-text-main: #0f172a;
--color-text-muted: #64748b;
--color-accent: #2563eb;

/* 4c. Typography scale */
--font-sans: system-ui, -apple-system, sans-serif;
--text-base: 1rem;
--text-xl: 1.5rem;
}

/* 5. Base body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: antialiased;
  color: var(--color-text-main);
  background-color: var(--color-canvas);
}

/* 6. Inherit fonts on form controls (browsers set them to monospace/ugly defaults) */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}

/* 7. Avoid text overflow on long words, URLs, or code */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* 8. Remove list styling when used for layout */
ul[role='list'], ol[role='list'] {
  list-style: none;
}

/* 9. Make textareas vertically resizable only (prevents breaking layouts horizontally) */
textarea {
  resize: vertical;
}

Layout Models

Model Dimension Container Properties (System) Child Properties (Overrides)
Flexbox (display: flex) 1D (Row OR Column) flex-direction, justify-content, align-items, gap, flex-wrap flex-grow, flex-shrink, flex-basis, align-self
CSS Grid (display: grid) 2D (Rows AND Columns) grid-template-columns, grid-template-rows, grid-template-areas, gap, place-items grid-column, grid-row, grid-area, justify-self, align-self

Common Layout Archetypes

1. The Centered Hero / Banner

Uses CSS Grid on the container to center content along both axes, with a column Flexbox child to control internal spacing.

/* Container: handles the background and 2D centering */
.hero-banner {
  min-height: 60vh;
  display: grid;
  place-items: center; /* Centers child on X and Y axes */
  padding: var(--space-lg);
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('assets/media/hero.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-align: center;
}

/* Content: manages vertical flow and line length */
.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  max-width: 65ch; /* Optimal reading line length */
}

2. Auto-Responsive Card Grid (No Media Queries)

Leverages repeat(), auto-fit, and minmax() to automatically determine column count based on available container width.

.card-grid {
  display: grid;
  /* Columns never shrink below 250px; wrap automatically when space is tight */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-md);
}

.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.card-footer {
  margin-top: auto; /* Pushes footer to bottom across cards of varying height */
}

3. Full-Page Macro Scaffolding

Uses named grid areas for transparent, 2D page architecture without margin math.

.site-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header  header"
    "sidebar main"
    "footer  footer";
}

.site-header  { grid-area: header; }
.site-sidebar { grid-area: sidebar; }
.site-main    { grid-area: main; }
.site-footer  { grid-area: footer; }

Mobile-First & Responsive Rules

Principle Problem It Solves Implementation
Viewport Meta Tag Prevents mobile browsers from rendering at desktop width (980px) and scaling down. <meta name="viewport" content="width=device-width, initial-scale=1.0"> in <head>.
Mobile-First Cascade Eliminates specificity wars and media query overriding conflicts. Write base styles outside queries (single-column flow). Add multi-column rules inside @media (min-width: ...).
Fluid vs. Fixed Widths Prevents horizontal scrollbars on screens narrower than a hardcoded pixel width. Replace width: 800px; with width: 100%; max-width: 800px; or min(100%, 800px);.
Intrinsic Aspect Ratios Prevents image distortion and layout shifts during page loading. Apply max-width: 100%; height: auto; to all media elements in the reset.

Standard Mobile-First Breakpoint Scaffold

/* 1. Base / Mobile (Default): 1-column natural flow, no media query */
.container {
  width: 100%;
  padding: var(--space-sm);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

/* 2. Tablet Breakpoint (min-width: 768px): Introduce 2 columns */
@media (min-width: 768px) {
  .container {
    padding: var(--space-md);
  }
  
  .content-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
}

/* 3. Desktop Breakpoint (min-width: 1024px): Expand macro structure */
@media (min-width: 1024px) {
  .container {
    max-width: 1200px;
    margin-inline: auto; /* Center page container horizontally */
  }

  .content-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}