CSS id doesn't work, please help me

Please can someone help me, the navbar-icon id doesn’t work in css.

HTML code for the mobile navbar

<nav id="navbar-mobile">
    <ul>
        <li>
            <div id="#navbar-icon">
                <div></div>
                <div></div>
            </div>
        </li>
        <ul>
            <li><a href="#"> intruduktion </a></li>
            <li><a href="#"> om mig </a></li>
            <li><a href="#"> projekt & arbeten </a></li>
            <li><a href="#"> kontakta </a></li>
        </ul>
    </ul>
</nav>

CSS code for the mobile navbar

#navbar-mobile #navbar-icon {
    width: 64px;
    height: 64px;
    display: block;
    position: relative;
    background-color: red;  
    padding: 20px;
}

Not really sure what you’re trying to do but this line looks wrong to me. The hash symbol # should probably not be used there.

2 Likes

As @hbar1st said, the hash (#) does not belong in <div id="#navbar-icon">. You need the # when linking to a document fragment (something like <a href="#navbar-icon">navbar</a> , when using the id as a selector in your CSS, or when selecting the element with JavaScript using querySelector or querySelectorAll (as well as jQuery).

`

1 Like

Thanks for the info and help

1 Like

I really dont think that your nav id should iclude ‘#’ symbol!!!

Your are correct, it was mistake i made