'How can I create a rounded underling beneath my text? [duplicate]
how can I create a rounded underline beneath my text?
So far I've tried using the code to add CSS and make a thicker line, etc.
I've also tried doing a text background, using border radius, and then offset it somehow but I can't seem to get it to work.
!Example(https://imgur.com/a/COFNjGD)
Solution 1:[1]
h1 {
display: inline-block;
}
.rounded-underscore {
border: 6px solid rgba(0, 0, 255, .5);
border-radius: 10px;
margin-top: -15px;
}
<h1>This is text
<div class="rounded-underscore"></div>
</h1>
Solution 2:[2]
This might help
*,
*::before,
*::after {
box-sizing: border-box;
}
body{
min-height: 100vh;
/* background-color: bisque; */
display: grid;
place-content: center;
overflow: hidden;
}
.container{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
p{
font-size:5rem;
font-weight: 900;
position: relative;
z-index: 1;
width: fit-content;
}
p::before{
position: absolute;
content: "";
width:100%;
height: 30px;
bottom: 10%;
background-color: #dadada;
z-index: -1;
border-radius: 1rem;
}
<div class="container">
<p>Hello</p>
<p>Lorem, ipsum.</p>
<p>Lorem, ipsum dolor.</p>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | fnostro |
| Solution 2 |
