Aligning Messed Up When Fixing Navigation bar to specific location

Hello, I am having problems with my navigation bar formatting. Currently, my HTML code is as follows:

<div class="header">
            <img class="logo" src=""> 
                <li>Featured Tea</li>

and my relevant CSS code is

.header {
    height: 69px;
    border-bottom: 1px solid seashell;
.logo {
    height: 50px;
    margin-left: 10px;

.header ul {
    color: white;
    float: right;

.header li {
    display: inline-block;   
    text-decoration: underline; 
    padding-right: 10px;

This allows my logo image to be left aligned in the nav bar and the list to be to the right, with a white border underneath. However, when i add the position: fixed to my .header, I lose this formatting and everything groups toward the left. Why could this be happening?

Hello @abhimanyd2001! Welcome to the forums!! :grinning:

I’m not entirely sure why fixed won’t work, I believe it is do to the fact that fixed will automaticly try to take up as little space as possible.

For the specific purpose of a page header you can use the sticky position:

.header {
position: sticky;
top: 10px;

This will allow the element to scroll with the page until it reaches a given point, in this example it is 10px from the top. Since it is already bordered with the top it won’t scroll with the rest of the page.

Hopefully this helps :grinning:

Hello, I am having the same problem right now, according to the specs the navigation bar should be fixed but then it’s impossible to use the flexbox to keep the logo on the left and the navigation list on the right… and using sticky doesn’t seem to work. I am tempted to just ignore the request to have the navigation fixed, but is there actually a possible solution???