Skip to content
Learn Netverks

Lesson

Step 12/58 21% through track

colors

Colors in HTML history and today

Last reviewed May 28, 2026 Content v20260528
Track mode
iframe_html
Means
HTML preview sandbox
Reading
~2 min
Level
advanced

This lesson

This lesson teaches Colors in HTML history and today—the ideas, syntax, and habits you need before moving on in HTML.

Without a solid grasp of Colors in HTML history and today, you will repeat mistakes in HTML exercises and on real pages or scripts.

You will apply Colors in HTML history and today in contexts like: Websites, hybrid apps, email templates, design systems, and CMS-driven content.

Read the lesson, edit HTML/CSS in the playground, press Run to preview, then answer the lesson MCQs. Also use the HTML reference desk when you need tag or attribute lookup.

When intermediate lessons feel comfortable and you are ready for production-style trade-offs.

Early HTML mixed presentation with structure (font, bgcolor). Those facilities are obsolete for modern web apps—CSS owns color and typography.

Modern approach

  • Define palettes with CSS custom properties or preprocessor variables.
  • Apply color, background-color, gradients, and filters in stylesheets.
  • Use SVG/CSS for icons instead of bitmaps when you need infinite scaling.

Accessibility requirements

  • Maintain contrast between text and backgrounds (WCAG AA is a common baseline).
  • Never rely on color alone to convey state—pair with text, icons, or patterns.
  • Respect prefers-color-scheme and user themes.

Images and color

Raster images encode colors in pixels; SVG uses fills and strokes in markup or CSS. Canvas pixels are manipulated via JavaScript—outside raw HTML color attributes.

Example — captions reinforce meaning beside pixels

<figure>
  <img
    src="/images/img_8124.webp"
    width="1280"
    height="960"
    alt="Wide landscape sample photo from the course image pack."
    loading="lazy"
  >
  <figcaption>Meaning survives color-inversion modes because the caption is plain text—not just warm/cool hues in the JPEG.</figcaption>
</figure>

Rendered output

Wide landscape sample photo from the course image pack.
Meaning survives color-inversion modes because the caption is plain text—not just warm/cool hues in the JPEG.

What teams forget

  • Contrast is contractual: WCAG-ish ratios are baseline for text; QA should include forced-colors / high contrast modes—not only brand palettes.
  • State without hue: error/success/disabled cues need text, icons, or patterns—not “red versus green alone.”
  • Inherited palettes: marketing hex values pasted into prose can break readability on tinted cards—enforce tokens.

Important interview questions and answers

  1. Q: When should you use `strong` vs `b`?
    A: Use `strong` for semantic importance; use `b` only for stylistic offset without importance semantics.
  2. Q: Why is `target="_blank"` usually paired with `rel="noopener"`?
    A: It blocks the opened page from controlling the opener via `window.opener`, improving security.
  3. Q: Why avoid fake buttons built with ``?
    A: Anchors are for navigation; actions should use `

Tip: Prefer CSS custom properties for theme colors, not deprecated font tags.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • What confused you about this lesson?
  • How would you explain this to a teammate in 30 seconds?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump