I want output as follows btw currently I'm using bellow CSS to do this
.text-underline {
border-bottom: 4px solid #f8f8f8;
padding: 0 0 2px;
}
But it applies to whole text are and I want to reduce width of this line
I want output as follows btw currently I'm using bellow CSS to do this
.text-underline {
border-bottom: 4px solid #f8f8f8;
padding: 0 0 2px;
}
But it applies to whole text are and I want to reduce width of this line
It's very simple using a pseudo element:
.text-underline:after {
display: block;
height: 0;
width: 5%; /* any width of your choice with any units e.g. px, em... */
border-bottom: 4px solid #ff0000;
content: "";
}
It's possible with pseudo-elements
, like this:
span {
position: relative;
font-weight: bold;
font-size: 20px;
}
span::after {
display: block;
content: '';
width: 40px;
height: 2px;
background-color: red;
}
<span>Search Options</span>
You have selected the entire item and need to use an element like span to isolate the "Search" part of your HTML
<h1> <span class="text-underline"> Search </span> Options </h1>
Try that out