-
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 Gradients allow you to create smooth transitions between two or more colors without using images. They are used as backgrounds and can be linear, radial, or conic.
Linear Gradients – transition in a straight line
Radial Gradients – transition in a circular pattern
Conic Gradients – transition around a center point
div {
background: linear-gradient(to right, red, yellow);
}
Directions:
to right
, to left
, to top
, to bottom
45deg
, 90deg
, etc.
background: linear-gradient(45deg, blue, green);
div {
background: radial-gradient(circle, red, yellow, green);
}
You can also use ellipse
shape:
background: radial-gradient(ellipse, red, blue);
div {
background: conic-gradient(from 0deg, red, yellow, green, red);
}
🟠 Supported in most modern browsers.
div {
background: linear-gradient(to right, red, orange 20%, yellow 40%, green 60%, blue 80%, violet 100%);
}
You can specify where each color starts in percentages.
Use rgba()
or hsla()
for transparency:
background: linear-gradient(to bottom, rgba(255, 0, 0, 0.8), rgba(0, 0, 255, 0.2));
background: repeating-linear-gradient(45deg, red, red 10px, white 10px, white 20px);
Useful for striped or patterned effects.
Q1. Create a horizontal linear gradient from red to yellow.
Q2. Add a vertical linear gradient from blue to green.
Q3. Create a radial gradient with three colors.
Q4. Apply a conic gradient that loops red, yellow, and blue.
Q5. Use a 45-degree linear gradient from pink to violet.
Q6. Add transparency using rgba()
in a linear gradient.
Q7. Make a repeating linear gradient for a stripe pattern.
Q8. Use a radial ellipse gradient for a background.
Q9. Add 5 color stops with varying percentages in a linear gradient.
Q10. Apply a gradient as the background of a button.
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)