Modern Web Guidance is now stable! Upgrade your coding agents with expert-vetted web development best practices.
Read the announcement.
Use conic gradients to create a cool border
Stay organized with collections
Save and categorize content based on your preferences.
Conic gradients can be used to create some interesting effects, such as this nice border example.
This CodePen created by Adam
Argyle, originally shared via this
tweet on Twitter,
shows how to use a conic
gradient to
create a border.
.conic-gradient-border {
border: 25px solid;
border-image-slice: 1;
border-image-source: conic-gradient(
hsl(100 100% 60%),
hsl(200 100% 60%),
hsl(100 100% 60%)
);
}
Terry Mun creatively
forked
Adam's codepen and created this
CodePen. Move your mouse over the
element and you'll see the gradient change, thanks to a little bit of JavaScript
updating a CSS custom property that stores the rotation angle.
These examples uses the
border-image-source
property. This property sets the source image used to create an element's
border. As with other properties that accept an image value, any CSS gradient
type is valid too.
border-image-source
Conic gradient
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-05-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-05-27 UTC."],[],[]]