- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Setting the Location Color Stops using CSS
The location at color stops can be set as a percentage or absolute length. For example, for linear gradient
background-image: linear-gradient( rgb(61, 255, 2) 40%, rgb(0, 174, 255) 80%, rgb(255, 29, 29) 20% );
Following is the code for setting the location color stops in linear gradient using CSS −
Example
<!DOCTYPE html> <html> <head> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .even { height: 100px; background-image: linear-gradient( rgb(61, 255, 2), rgb(0, 174, 255), rgb(255, 29, 29) ); } .uneven { height: 100px; background-image: linear-gradient( rgb(61, 255, 2) 40%, rgb(0, 174, 255) 80%, rgb(255, 29, 29) 20% ); } </style> </head> <body> <h1>Linear gradient location color stops</h1> <h3>Evenly Spaced</h3> <div class="even"></div> <h3>Unevenly Spaced</h3> <div class="uneven"></div> </body> </html>
Output
The above code will produce the following output −
- Related Articles
- Setting Text Color using CSS
- Setting the Color of Links using CSS
- Setting up Background Color using CSS
- Creating Linear Gradients using Multiple Color Stops in CSS
- Setting the element's text color using CSS
- Setting Color Property in CSS
- Setting up Background Color in CSS
- Setting Text Color Working with CSS
- Create a differently spaced Color Stops with CSS Radial Gradients
- Create an evenly spaced color stops with CSS Radial Gradients
- Setting Line Height using CSS
- Setting Background Position using CSS
- Setting Text Alignment using CSS
- Setting Background Image using CSS
- Setting List Style Type using CSS

Advertisements