Adding a line behind text


I am trying to add a line behind some text.

I have the following fiddle, but I can’t work out how to have it the same length of the numbers which will change depending on the page.

Any ideas how I can have it same length of the number text?


Couldn’t you just set the background color on span.count

If not, perhaps something like this will work for you…

<html lang="en">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Test Page</title>
.categories span{
  font-size: 20px;
  position: relative;
  height: 20px;
  z-index: -1;
  background: #ff0000;


<section id="title">
  <div class="container categories">
    <h1>Title Here</h1>
    <span>Browse from
      <span class="count">1444,1444</span>

1 Like

Awesome :slight_smile: Many thanks, it worked great!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.