-2

Is it possible to include line like this behind the text?

enter image description here

Filburt
  • 17,626
  • 12
  • 64
  • 115
  • You can use pseudo-elements `::after` or `::before`. – Anton Jul 28 '21 at 21:18
  • But with the ::after ::before property, the line will work like a border.. for example it can be just under the whole text, not individualy in every line.. I need to make that background in every single line, that means if line increase the background will also increase and there will be the separation like the paragraph – imranhossainbpp Jul 28 '21 at 21:22

1 Answers1

-1

Here's how I did it using styled components without sudo elements:

export const LineBehind = styled.div`
  width: 100%;
  text-align: center;
  border-bottom: 1px solid gray;
  line-height: 0.1em;
  color: black;

  span {
    /* background: #fff; */  # un-comment to wrap line around text (not thru)
    padding: 0 10px;
    font-size: 1.2rem;
  }
`

Ends up looking like this enter image description here

So in your case, you could increase the border size and change the color to achieve the desired result

Eli Johnson
  • 1,492
  • 1
  • 10
  • 10