KoderSolutionKoderSolution LogoKoderSolution Logo
HomeArticlesTutorialsToolsRun CodeForumAI Lab
🌐

HTML

Topic Hub & Articles

HTML Introduction

5 min

HTML Editors

10 min

Recap Quiz

Gated

Milestone Assessment

HTML Basic

10 min

HTML Elements

10 min

HTML Attributes

10 min

HTML Headings

10 min

HTML Paragraphs

10 min

Recap Quiz

Gated

Milestone Assessment

HTML Styles

10 min

HTML Formatting

10 min

HTML Quotations

10 min

HTML Comments

10 min

HTML Colors

7 min

HTML CSS

10 min

Recap Quiz

Gated

Milestone Assessment

HTML Links

10 min

HTML Images

10 min

HTML Favicon

10 min

HTML Page Title

10 min

HTML Tables

10 min

Recap Quiz

Gated

Milestone Assessment

HTML Lists

10 min

HTML Block and Inline

10 min

HTML Classes

10 min

HTML ID

10 min

HTML Iframes

10 min

Recap Quiz

Gated

Milestone Assessment

HTML JavaScript

10 min

HTML File Paths

10 min

HTML Head

10 min

HTML Layout

10 min

HTML Responsive

10 min

Recap Quiz

Gated

Milestone Assessment

HTML Computercode

10 min

HTML Forms

10 min

Recap Quiz

Gated

Milestone Assessment

HTML Form Attributes

10 min

HTML Form Elements

10 min

HTML Input Types

10 min

HTML Input Attributes

10 min

Recap Quiz

Gated

Milestone Assessment

HTML Input Form Attributes

10 min

HTML Canvas

10 min

HTML SVG

10 min

Recap Quiz

Gated

Milestone Assessment

HTML Media Intro

10 min

HTML Video

10 min

HTML Audio

10 min

Recap Quiz

Gated

Milestone Assessment

HTML YouTube

10 min

HTML Geolocation

10 min

HTML Drag/Drop

10 min

HTML Local Storage

10 min

HTML Session Storage

10 min

HTML Web Workers

10 min

HTML SSE

10 min

HTML Semantics

10 min

HTML Accessibility

10 min

HTML Entities

10 min

HTML Symbols

10 min

HTML Emojis

10 min

HTML Charset

10 min

HTML URL Encode

10 min

Recap Quiz

Gated

Milestone Assessment

HTML XHTML

10 min

HTML Global Attributes

10 min

HTML Event Attributes

10 min

HTML Color Groups

10 min

Recap Quiz

Gated

Milestone Assessment

HTML URL Paths

10 min

HTML Summary

10 min

Progress
0%

0 / 60 Lessons

KoderSolutionKoderSolution LogoKoderSolution Logo

The world’s most advanced technical ecosystem for modern software engineers. Learn, build, and grow with next-generation developer tools and resources.

Facebook PageX (Twitter) ProfileYouTube ChannelContact Support

Engineering Newsletter

Subscribe for weekly software engineering tutorials, architecture guides, and developer tool updates.

Platforms

  • Technical Articles
  • Interactive Tutorials
  • AI Coding Lab
  • Developer Forum
  • Developer Tools

Pages

  • About Us
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Refund Policy
  • Disclaimer
  • Advertisement

Popular Topics

  • PHP
  • Laravel
  • Python
  • React.Js
  • MySQL
© 2026 KoderSolutionAll Rights Reserved
Developed Bymaksudur.dev
HTMLHTML Tutorial
Lesson

HTML Colors

7 min reading
Free Course

HTML Colors: Named, Hex, RGB, and HSL Formats

HTML elements receive color through CSS properties like color, background-color, and border-color. Modern browsers support 140 standard color names alongside Hexadecimal, RGB, and HSL color values for precise shade control and transparency.

Comparing Color Formats

Color keywords like Tomato or SlateBlue are handy for quick demos, while Hex and HSL give exact control over brand palettes:

  • Hex (#RRGGBB): Uses six hexadecimal digits (00 to FF) for Red, Green, and Blue channels, such as #2563eb.
  • RGB / RGBA: Defines Red, Green, and Blue values from 0 to 255, with optional Alpha opacity (0 to 1).
  • HSL / HSLA: Uses Hue (0–360 degrees), Saturation (0%–100%), and Lightness (0%–100%), making lighter and darker shades easy to generate.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTML Colors Example</title>
</head>
<body style="font-family: system-ui, sans-serif; padding: 20px;">
    <div style="background-color: #1e293b; color: #f8fafc; padding: 16px; margin-bottom: 12px;">
        Hex background (#1e293b) with crisp white text (#f8fafc)
    </div>
    <div style="background-color: rgba(37, 99, 235, 0.15); color: #1d4ed8; padding: 16px; margin-bottom: 12px;">
        RGBA translucent blue banner (15% opacity)
    </div>
    <div style="background-color: hsl(142, 72%, 29%); color: #ffffff; padding: 16px;">
        HSL dark emerald green card
    </div>
</body>
</html>

Accessibility Contrast Standards

Always check contrast between foreground text and its background color. WCAG AA guidelines recommend at least a 4.5:1 contrast ratio for normal body text so low-vision users and outdoor mobile visitors can read easily.

Common Mistakes to Avoid

  • Using low-contrast light gray text on white: Pale shades like #cbd5e1 on #ffffff look sleek on bright monitors but become unreadable on phones.
  • Using HTML4 attributes like bgcolor: Never write bgcolor="blue" on body tags. Always apply colors using CSS properties.
  • Mixing up opacity and rgba(): Setting CSS opacity fades the child text too, while rgba() fades only the background color.

Frequently Asked Questions

Which color format should I pick for a design system?

HSL or modern Hex with CSS custom properties work best because HSL lets you adjust brightness cleanly for hover and disabled states.

What does the fourth value in RGBA or HSLA control?

The fourth value sets alpha transparency from 0 (completely invisible) to 1 (fully solid).

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol

Try it Yourself

Experiment with the code from this lesson in our interactive playground.

Open Playground

Related Developer Tools & Topic Hub

HTML Topic Hub
HTML Formatter
Beautify and inspect HTML markup
CSS Formatter
Clean and format stylesheets
PX to REM Converter
Calculate responsive CSS units
All HTML Articles
Deep-dive guides, tips & discussions
PreviousHTML Comments
Continue JourneyNext: HTML CSS

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum