CSS gradients allow you to display smooth transitions between two or more specified colors. They can be used to create visually appealing backgrounds, borders, and other elements without the need for images.
Linear gradients transition colors along a straight line. You can specify the direction of the gradient using angles or keywords like 'to right', 'to bottom', etc.
Radial gradients transition colors outward from a central point, creating a circular or elliptical pattern. You can control the shape and size of the gradient.
Conic gradients rotate colors around a central point, similar to the spokes of a wheel. They are useful for creating pie chart effects and other circular designs.
.gradient-background {
background: linear-gradient(to right, #ff7e5f, #feb47b);
}
You can define multiple color stops in a gradient to create complex patterns. Each stop is defined by a color and an optional position.
Repeating gradients allow you to repeat the gradient pattern indefinitely. This is useful for creating striped or checkerboard patterns.
.repeating-gradient {
background: repeating-linear-gradient(
45deg,
#606dbc,
#606dbc 10px,
#465298 10px,
#465298 20px
);
}
Console Output:
Background with linear gradient from #ff7e5f to #feb47b
In linear gradients, you can specify the direction using angles (e.g., 45deg) or keywords (e.g., 'to right'). This determines the path along which the colors transition.
Using angles provides precise control over the gradient direction. For example, '90deg' creates a vertical gradient from bottom to top.
.angled-gradient {
background: linear-gradient(135deg, #89f7fe, #66a6ff);
}
Keywords like 'to right' or 'to bottom left' provide an intuitive way to set gradient directions without needing to calculate angles.
.keyword-gradient {
background: linear-gradient(to bottom right, #fbc2eb, #a6c1ee);
}
Console Output:
Gradient with direction to bottom right
Radial gradients can be either circular or elliptical. By default, they are circular, but you can specify 'ellipse' to change the shape.
You can control the size of radial gradients using keywords like 'closest-side', 'farthest-corner', or specific lengths.
.circle-gradient {
background: radial-gradient(circle, #ff9a9e, #fad0c4);
}
The center of a radial gradient can be positioned using percentages or keywords like 'center', 'top left', etc.
.ellipse-gradient {
background: radial-gradient(ellipse at center, #a1c4fd, #c2e9fb);
}
Console Output:
Radial gradient with ellipse shape at center
You can layer multiple gradients on top of each other to create complex designs. This involves specifying multiple gradient functions separated by commas.
Using RGBA or HSLA color values allows you to introduce transparency into your gradients, creating a fading effect.
.layered-gradient {
background: linear-gradient(to right, rgba(255, 0, 0, 0.5), rgba(0, 0, 255, 0.5)),
radial-gradient(circle, rgba(255, 255, 0, 0.5), rgba(0, 255, 0, 0.5));
}
CSS animations can be applied to gradients to create dynamic effects. This involves animating the properties of the gradient over time.
@keyframes gradient-animation {
0% { background-position: 0% 50%; }
100% { background-position: 100% 50%; }
}
.animated-gradient {
background: linear-gradient(270deg, #ff7e5f, #feb47b);
background-size: 200% 200%;
animation: gradient-animation 5s ease infinite;
}
Console Output:
Layered and animated gradient effects
Gradients can be used to enhance button designs, providing a modern and attractive look. They can be applied to the button's background or border.
Applying gradients to text can create eye-catching typography. This is achieved using the 'background-clip' property set to 'text'.
.gradient-button {
background: linear-gradient(to right, #ff758c, #ff7eb3);
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 12px;
}
Gradients are commonly used as backgrounds for web pages and overlays for images, adding depth and interest to the design.
.text-gradient {
background: linear-gradient(to right, #fbc2eb, #a6c1ee);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
Console Output:
Stylish buttons and text with gradients
Newsletter
Subscribe to our newsletter for weekly updates and promotions.
Wiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterCompany
About usCareersPressCompany
About usCareersPressCompany
About usCareersPressLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesCompany
About usCareersPressCompany
About usCareersPressCompany
About usCareersPressLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesAds Policies