0

I am trying to vertical-align 2 lines and a title. But it doesn't work correctly. My html code is-

<div class="content-fluid">
    <div class="row d-flex justify-content-center m-0">
        <div class="our-service-head">
            <p class="our-service-title text-center">Our Services</p>
        </div>
    </div>
</div>

and style.css:

.our-service-title{
    color: #222222;
    font-size: 24px;
    font-weight: 600;
}

.our-service-title:before, .our-service-title:after{
    content:" ";
    display: inline-block;
    vertical-align: super;
    margin-left: 10px;
    margin-right: 10px;
    width: 30px;
    height: 3px;
    background-color: #FFC000;
}

it shows like the following output:

enter image description here

How can I align this correctly?

Kanchon Gharami
  • 777
  • 1
  • 11
  • 30

1 Answers1

1

Use vertical-align: middle; on the pseudo element:

.our-service-title{
    color: #222222;
    font-size: 24px;
    font-weight: 600;
}

.our-service-title:before, .our-service-title:after{
    content:" ";
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
    margin-right: 10px;
    width: 30px;
    height: 3px;
    background-color: #FFC000;
}
<div class="content-fluid">
    <div class="row d-flex justify-content-center m-0">
        <div class="our-service-head">
            <p class="our-service-title text-center">Our Services</p>
        </div>
    </div>
</div>
Johannes
  • 64,305
  • 18
  • 73
  • 130