-1

I want to create a navbar that is split into 2 parts, one side having the icon for bars and the other having the company name. I have the icon declared at 20% and the name at 80% but these do not align. On the web inspector, the icon seems to have padding applied to the right of it like so:

enter image description here

But the padding is not applied to name :

enter image description here

Here is the HTML:

<div class="smallHeader">
    <div class="menuBars">
        <span class="fas fa-bars"></span>
    </div>

    <div class="title">
        <i class="fas fa-microphone-alt"></i>
        <span>{{ config('app.name', 'OnAirCasts') }}</span>
    </div>

    <div class="clearFix"></div>
</div>

And here is the CSS:

/*--- Small Nav bar ---*/
.smallHeader{
    width: 100%;
}

.menuBars {
    width: 20%;
    text-align: center;
}

.title {
    width: 80%;
    float: left;
    text-align: center;
}

Why is this padding being added?

Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
RC07JNR
  • 535
  • 1
  • 8
  • 24

2 Answers2

0
.smallHeader{
    width: 100%;
    display: flex;
}

Sachin Kumar
  • 366
  • 1
  • 6
  • 20
-2

Most likely the origin of the padding comes from another element, inspect the inner element (maybe the text in your span).

You could also try to set a fixed height for the .title class

kev.proxbit
  • 106
  • 1
  • 4