2

Can you please let me knoe how I can upgrade the following code to make the result looks like

enter image description here

p::before {
   content: "";
    display: block;
    height: 1px;
    width: 20%;
    margin: 10px;
    background: #f00;
}
p::after {
   content: "";
    display: block;
    height: 1px;
    width: 20%;
    margin: 10px;
    background: #f00;
}
<div class="col-md-12"><p>paragraph text</p></div>

Right now I am getting this

enter image description here

Behseini
  • 6,066
  • 23
  • 78
  • 125

1 Answers1

1

Changed display to inline-block and I also changed margin to a em value so it will scale according to font-size

p::before {
   content: "";
    display: inline-block;
    height: 1px;
    width: 20%;
    margin: 0.3em;
    background: #f00;
}
p::after {
   content: "";
    display: inline-block;
    height: 1px;
    width: 20%;
    margin: 0.3em;
    background: #f00;
}
<div class="col-md-12"><p>paragraph text</p></div>
arc
  • 4,553
  • 5
  • 34
  • 43