mandar262 mandar262 - 2 months ago 8
CSS Question

How to align website header and navigational menu on same line?

I want to align website header text(not logo/img) to left and navigational menu to the right on same line

Answer

Either use floats or inline-blocks

HTML

<header>
    <div class="left">Left</div>
    <div class="right">Right</div>
</header>

CSS

.left {
    float: left;
    width: 50%;
}

.right {
    float: right;
    width: 50%;
}
OR CSS

.left {
    display: inline-block;
    width: 50%;
}

.right {
    display: inline-block;
    width: 50%;
}