HTML Colors

HTML Colors

HTML allows you to apply colors to text, backgrounds, borders, and other elements using the style attribute.

Colors can be defined in different ways such as:

  • Color Names (red, blue, green)

  • HEX Values (#ff0000)

  • RGB Values (rgb(255, 0, 0))

  • HSL Values (hsl(0, 100%, 50%))


Example Code


 


Output Preview

  • Red text

  • Green text (HEX format)

  • Blue text (RGB format)

  • Yellow background

  • HSL-style colored background


Color Types Summary

Type Example
Name red, blue
HEX #ff0000
RGB rgb(255, 0, 0)
HSL hsl(0, 100%, 50%)

Colors make your webpage more attractive and help highlight important content.

CodeCapsule

Sanjit Sinha — Web Developer | PHP • Laravel • CodeIgniter • MySQL • Bootstrap Founder, CodeCapsule — Student projects & practical coding guides. Email: info@codecapsule.in • Website: CodeCapsule.in

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *