Aligning elements side by side correctly

Asked

Viewed 80 times

0

I’m not being able to align elements side by side correctly
To Div feels like I’m with Height: 0;
Just recognizing the height of the element without the Float: left;
ERRADO

CERTO

HTML

The first is how it turned out. The second as it had to be.


    <div id="logo"></div>

    <nav id="menu">
        <ul>
            <li><a href="#">Sobre</a></li>
            <li><a href="#">Trabalhos</a></li>
            <li><a href="#">Contato</a></li>
        </ul>
    </nav>

</div>
</header>


CSS

a {
text-decoration: none;
color: #4B4B4B;
}

div#top-bar {

background-color: #f14949;
padding: 25px 80px 25px 80px;
}

div#logo {
vertical-align: middle;
float: left;
width: 86px;
height: 51px;
background-color: #4B4B4B;
border-radius: 6px;
}
nav#menu {

text-align: right;
}
nav#menu ul {
list-style: none;
}

nav#menu li {
display: inline-block;
}
  • Welcome to Stack Overflow. Steve, don’t duplicate questions, you can always edit a question and add you more information by clicking the button editar below your post instead of creating new questions that are repeated. I added an answer there to your original question. Take a look there. Welcome :)

  • Sorry, I tried to edit, and even delete the other post before doing this but could not :(. And thank you again.

  • 1

    The buttons - editar, excluir are below each publication (question/answer) right after the tags of the question. But if you are going to delete one of the questions, delete this one, because I already edited the other one with the additional information you have added here and also because I already added an answer there, because it was the original.

No answers

Browser other questions tagged

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