-5

enter image description here

I just want a simple css and HTML to fix this issue.

Pranav Totla
  • 2,182
  • 2
  • 20
  • 28
Abhi
  • 21
  • 3

2 Answers2

0

I hope this will help,

.heading{
  display: block;
    width: 100%;
    position: relative;
    text-align: center;
    padding: 50px 0px;
}
.heading h2{
  font-size: 25px;
    color: #000;
    text-align: center;
    display: inline-block;
    background-color: #fff;
    width: 40%;
    margin: auto;
}

.heading:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    left: 0;
    background: #000;
    top: 50%;
    z-index: -1;
}
<div class="heading">
  <h2>Function</h2>
</div>
VISHAL SINGH
  • 651
  • 1
  • 8
  • 20
0

.wrapper{
    position: relative;
    text-align: center;
    padding: 50px 0px;
}
.wrapper h2{
    font-size: 24px;
    color: #000;
    text-align: center;
    display: inline-block;
    background-color: #fff;
    padding: 0 30px;
    margin: auto;
}

.wrapper:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    left: 0;
    background: #999;
    top: 50%;
    margin-top: -1px; /*this will keep this line vertically center to heading text*/
    z-index: -1;
}
<div class="wrapper">
  <h2>Functions</h2>
</div>
Atul Rajput
  • 4,073
  • 2
  • 12
  • 24