Nav problem in css

Asked

Viewed 117 times

0

Well I created a Nav with class = topbar and tried calling in css but it’s not going:

<nav class="topBar">
<ul>
<a href="#"><li>Inicio</li></a>
<a href="#"><li>Inicio</li></a>
<a href="#"><li>Inicio</li></a>
<a href="#"><li>Inicio</li></a>
</ul>
</nav>
<img src="images/logosecure.png">
</header>

css

    @charset "utf-8";
*{margin:0;padding:0;}
header{
    width: 100%;
    height: 200px;

}
section{
    width: 100%;
    height: 500px;
    background: #ccc;
}
footer{
    width: 100%;
    height: 50px;
    background: #000;
}
a{
    text-decoration: none;
}
.topBar nav{
    width: 100%;
    margin:0 auto;
    background: #000;
}
.topBar nav ul li{
    background: #000;
    color:#fff;
    display: inline-block;
    padding: 10px 20px;
    border-bottom: 2px solid #000;
}
.topBar nav ul li:hover{
    cursor: pointer;
    border-bottom: 2px solid #fff;
}

photo: inserir a descrição da imagem aqui

1 answer

2

.topBar nav will search for an element <nav> within any other element having the class topBar.

What you want is nav.topBar, an element <nav> classy topBar

  • Nav.topbar{ width: 100%; margin:0 auto; background: #000; } Nav.topbar ul li{ background: #000; color:#fff; display: inline-block; padding: 10px 20px; border-bottom: 2px Solid #000; } Nav.topbar ul li:Hover{ cursor: Pointer; border-bottom: 2px Solid #fff; } I did that and continued the same way man.

  • Make sure you don’t have another CSS that is changing the same elements

  • there’s no css man with just that code.

  • You changed the class name in the CSS of .topBar for .topbar, in HTML as well?

  • Opa man I managed to arrange creating a div containing the Nav, vlw man ( I created the div with the name topbar) and in css botei . topbar Nav.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.