Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Colors in HTML

Colors in HTML

? Colors in HTML

In HTML, colors are used to style text, backgrounds, borders, and more. You typically control colors with CSS, but you specify color values in various formats.


Ways to Specify Colors

1. Color Names

Simple names like:

<p style="color: red;">Red text</p>

Common color names: red, blue, green, black, white, yellow, orange, purple, pink, etc.


2. Hexadecimal (Hex) Colors

Starts with # followed by 3 or 6 hexadecimal digits (0-9, A-F):

<p style="color: #FF0000;">Red text</p>
  • #FF0000 = Red

  • #00FF00 = Green

  • #0000FF = Blue

  • Short form: #F00 = #FF0000


3. RGB Colors

Define red, green, blue components (0–255):

<p style="color: rgb(255, 0, 0);">Red text</p>

4. RGBA Colors (RGB + Alpha for transparency)

Alpha goes from 0 (transparent) to 1 (opaque):

<p style="color: rgba(255, 0, 0, 0.5);">Semi-transparent red</p>

5. HSL Colors

Hue, Saturation, Lightness:

<p style="color: hsl(0, 100%, 50%);">Red text</p>

Example: Styling Text and Background Colors

<p style="color: white; background-color: #007BFF;">  White text on blue background</p>

Summary

FormatExampleNotes
Color NameredEasy but limited colors
Hex#FF5733Most common in web design
RGBrgb(255,87,51)Precise control
RGBArgba(255,87,51,0.7)Transparency
HSLhsl(9,100%,60%)Intuitive color adjustment

Want me to help you generate color palettes or show you how to use colors in CSS files?

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql