-1

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://i.stack.imgur.com/zIkI4.jpg)

2 Answers2

0

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>
fnostro
  • 4,531
  • 1
  • 15
  • 23
0

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>
UPinar
  • 1,067
  • 1
  • 2
  • 16