How to draw a colorful line and end with a dot under the text using css like this picture?
The underline start with spaces / padding.
.underline {
text-decoration: underline;
text-underline-offset: 10px;
display: inline-block;
position: relative;
padding: 20px 0px;
color: #2af6ff;
}
.underline::before {
transform: translateX(-50%);
border-radius: 100%;
position: absolute;
background: #2af6ff;
bottom: 10px;
height: 10px;
content: '';
width: 10px;
left: 100%;
}
<div class="h3 fw-bolder mt-4 px-5"><span class="underline">Summary</span></div>
3
Answers
Here is a working example of what you want
try this:
Pseudo element "before" is used for border bottom (it isn’t a real border, so you can use linear gradient as background), and "after" is used for circle at right.
I would remove the use of an HTML element which is merely adding some styling – try to keep content and style separate.
This snippet uses both before and after pseudo elements to create the line and the circle.
A linear-gradient background image is given to the line.
Padding is given to the element itself on the left hand side and box-sizing is set to border-box so that the word is offset but the pseudo element drawing the line can pick up the full width.