-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
CSS Basics
CSS Styling Properties
CSS Box Model
CSS Margin
CSS Padding
CSS Borders
CSS Outline
CSS Height/Width
CSS Max-width
CSS Display
CSS Position
CSS Z-index
CSS Overflow
CSS Float
CSS Inline-block
CSS Align
CSS Box Sizing
CSS Text
CSS Fonts
CSS Icons
CSS Text Effects
CSS Web Fonts
CSS Colors
CSS Backgrounds
CSS Color Keywords
CSS Gradients
CSS Shadows
CSS Links
CSS Lists
CSS Tables
CSS Advanced Selectors & Features
CSS Combinators
CSS Pseudo-classes
CSS Pseudo-elements
CSS Attribute Selectors
CSS Specificity
CSS !important
CSS Units
CSS Variables
CSS @property
CSS Math Functions
CSS Media and Image Styling
CSS Image Styling
CSS Image Centering
CSS Image Filters
CSS Image Shapes
CSS object-fit
CSS object-position
CSS Masking
CSS Layout Techniques
CSS Website Layout
CSS Navigation Bar
CSS Dropdowns
CSS Image Gallery
CSS Counters
CSS Pagination
CSS Multiple Columns
CSS User Interface
CSS Flexbox
CSS Grid
CSS Responsive Design (RWD)
CSS allows you to set the color of text, background, borders, and other elements using multiple formats:
Named Colors (e.g., red
)
HEX Colors (e.g., #ff0000
)
RGB (e.g., rgb(255, 0, 0)
)
RGBA (includes transparency)
HSL / HSLA
CSS supports over 140 predefined color names.
h1 {
color: red;
}
🟢 Examples: blue
, green
, gold
, tomato
, navy
A 6-digit hexadecimal value representing Red, Green, and Blue.
p {
color: #00ff00; /* bright green */
}
Short form: #0f0
is same as #00ff00
RGB stands for Red, Green, Blue.
div {
background-color: rgb(255, 0, 0); /* red */
}
Values range from 0 to 255.
Same as RGB but with alpha (transparency).
div {
background-color: rgba(0, 0, 255, 0.5); /* semi-transparent blue */
}
Alpha ranges from 0 (transparent) to 1 (opaque)
HSL = Hue, Saturation, Lightness
HSLA = Same with Alpha (transparency)
p {
color: hsl(120, 100%, 50%); /* green */
}
div {
background-color: hsla(0, 100%, 50%, 0.3); /* transparent red */
}
h2 {
color: white;
background-color: black;
}
color: color-mix(in srgb, red 30%, blue);
⚠️ Supported only in modern browsers.
Q1. Make the text color red using a named color.
Q2. Use #00ffff
for background color.
Q3. Apply rgb(100, 150, 200)
as heading text color.
Q4. Set a semi-transparent black overlay using rgba
.
Q5. Color a div’s text in hsl(240, 100%, 50%)
.
Q6. Change background to transparent red using HSLA.
Q7. Apply a HEX color shorthand #0f0
to a paragraph.
Q8. Use color: white
with background-color: navy
.
Q9. Set heading text to 80% transparent using rgba
.
Q10. Apply light gray background using a named color.
CSS Basics
CSS Styling Properties
CSS Box Model
CSS Margin
CSS Padding
CSS Borders
CSS Outline
CSS Height/Width
CSS Max-width
CSS Display
CSS Position
CSS Z-index
CSS Overflow
CSS Float
CSS Inline-block
CSS Align
CSS Box Sizing
CSS Text
CSS Fonts
CSS Icons
CSS Text Effects
CSS Web Fonts
CSS Colors
CSS Backgrounds
CSS Color Keywords
CSS Gradients
CSS Shadows
CSS Links
CSS Lists
CSS Tables
CSS Advanced Selectors & Features
CSS Combinators
CSS Pseudo-classes
CSS Pseudo-elements
CSS Attribute Selectors
CSS Specificity
CSS !important
CSS Units
CSS Variables
CSS @property
CSS Math Functions
CSS Media and Image Styling
CSS Image Styling
CSS Image Centering
CSS Image Filters
CSS Image Shapes
CSS object-fit
CSS object-position
CSS Masking
CSS Layout Techniques
CSS Website Layout
CSS Navigation Bar
CSS Dropdowns
CSS Image Gallery
CSS Counters
CSS Pagination
CSS Multiple Columns
CSS User Interface
CSS Flexbox
CSS Grid
CSS Responsive Design (RWD)