-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
HTML5 Basics
HTML Introduction
HTML Editors
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Styles
HTML Formatting
HTML Quotations
HTML Comments
HTML Styling and Design
HTML Links and Media
HTML Layout and Structure
HTML Tables
HTML Lists
HTML Block & Inline
HTML Div
HTML Classes
HTML Id
HTML Head
HTML Layout
HTML Responsive
HTML Computercode
HTML Semantics
HTML Forms
HTML Forms
HTML Form Attributes
HTML Form Elements
HTML Input Types
HTML Input Attributes
Input Form Attributes
HTML Graphics
HTML APIs
HTML Advanced Topics
HTML colors are used to change the appearance of text, backgrounds, borders, and more. You can apply colors using the style
attribute with properties like:
color
(for text)
background-color
border-color
Color Names
Example: red
, blue
, green
, black
Hex Codes
Example: #FF0000
(red), #00FF00
(green)
RGB Values
Example: rgb(255, 0, 0)
(red)
RGBA Values
Example: rgba(0, 255, 0, 0.5)
— includes transparency
HSL Values
Example: hsl(240, 100%, 50%)
HSLA Values
Example: hsla(120, 100%, 50%, 0.3)
<p style="color: red;">This is red text.</p>
<p style="background-color: yellow;">Yellow background</p>
<p style="color: #00ff00;">This is green text.</p>
<p style="color: rgb(0, 0, 255);">Blue using RGB</p>
<p style="color: rgba(255, 0, 0, 0.5);">Red with transparency</p>
<p style="color: hsl(120, 100%, 25%);">Dark green with HSL</p>
<p style="color: hsla(240, 100%, 50%, 0.3);">Blue with transparency</p>
<h1 style="background-color: lightgray;">Heading with background</h1>
<div style="border: 2px solid blue; color: white; background-color: black;">
Colored box with text
</div>
Q1. Create a paragraph with text color set to blue using a color name.
Q2. Use a hex code to make text green.
Q3. Apply a yellow background to a heading.
Q4. Use rgb()
to display red text.
Q5. Display semi-transparent text using rgba()
.
Q6. Style a box with a background color and white text.
Q7. Use hsl()
to color a paragraph dark blue.
Q8. Create a button with a colored border using style
.
Q9. Add color to a table header using background-color.
Q10. Make a full section background orange and text black.
HTML5 Basics
HTML Introduction
HTML Editors
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Styles
HTML Formatting
HTML Quotations
HTML Comments
HTML Styling and Design
HTML Links and Media
HTML Layout and Structure
HTML Tables
HTML Lists
HTML Block & Inline
HTML Div
HTML Classes
HTML Id
HTML Head
HTML Layout
HTML Responsive
HTML Computercode
HTML Semantics
HTML Forms
HTML Forms
HTML Form Attributes
HTML Form Elements
HTML Input Types
HTML Input Attributes
Input Form Attributes
HTML Graphics
HTML APIs
HTML Advanced Topics