- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Selectors
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS Data Type - <gradient>
The CSS data type <gradient> is a unique kind of <image> that demonstrates a progressive transition between two or more colors.
A gradient has no intrinsic dimensions, which means, it has neither a natural or preferred size, nor a preferred ratio. The size of the gradient will match with the size of the element it is applied to.
Possible values
The CSS data type <gradient> is defined using one of the following functions as values:
linear-gradient(): Progressive transition between two or more colors along a straight line. Generated with the linear-gradient() function.
radial-gradient(): Progressive transition between two or more colors from a center point (origin). Generated with the radial-gradient() function.
conic-gradient(): Progressive transition between two or more colors around a circle. Generated with the conic-gradient() function.
repeating-linear-gradient(): Linear gradient that gets repeated to fill the space. Generated with the repeating-linear-gradient() function.
repeating-radial-gradient(): Radial gradient that gets repeated to fill the space. Generated with the repeating-radial-gradient() function.
Syntax
<gradient> = <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()>
CSS <gradient> - Linear gradient
The following example demonstrates the use of linear-gradient:
<html> <head> <style> div { height: 100px; width: 100px; } .basic-linear { background: linear-gradient(red, yellow, green, blue, pink); } </style> </head> <body> <h1>Basic linear gradient</h1> <div class="basic-linear"></div> </body> </html>
CSS <gradient> - Radial gradient
The following example demonstrates the use of radial-gradient:
<html> <head> <style> div { height: 100px; width: 100px; } .basic-radial { background: radial-gradient(red, yellow, green, blue, pink); } </style> </head> <body> <h1>Basic radial gradient</h1> <div class="basic-radial"></div> </body> </html>
CSS <gradient> - Conic gradient
The following example demonstrates the use of conic-gradient():
<html> <head> <style> div { height: 150px; width: 150px; } .basic-conic-gradient { background: conic-gradient(red, yellow); border-radius: 50%; } </style> </head> <body> <h1>Basic Conic Gradient</h1> <div class="basic-conic-gradient"></div> </body> </html>
CSS <gradient> - Repeating linear gradient
The following example demonstrates the use of repeating-linear-gradient:
<html> <head> <style> div { height: 200px; width: 400px; } /* A repeating gradient tilted 60 degrees, with three color stops */ .repeat-linear { background-image: repeating-linear-gradient(60deg, red, yellow 7%, black 10%); } </style> </head> <body> <h1>Repeating linear gradient</h1> <div class="repeat-linear"></div> </body> </html>
CSS <gradient> - Repeating radial gradient
The following example demonstrates the use of repeating-radial-gradient:
<html> <head> <style> div { height: 200px; width: 400px; } .repeat-radial { background: repeating-radial-gradient( ellipse farthest-side at 20% 20%, red, black 5%, yellow 5%, blue 10% ); background: repeating-radial-gradient( ellipse farthest-side at 20% 20%, red 0 5%, yellow 5% 10% ); } </style> </head> <body> <h1>Repeating radial gradient</h1> <div class="repeat-radial"></div> </body> </html>
To Continue Learning Please Login
Login with Google