3
I tried to create a menu with html and css without any framework, I used float:left
to place the image with the logo on the left and rest of the images that are anchors should be on the right but when using float:right
could help me identify the problem?
Obs.:
Doesn’t have to be with float
is that this was the way I tried. It is worth remembering that the menu accompanies the scroll of the site.
Below is the code I tried:
#wrap {
width:calc(100% - 1px);
}
body {
font-family: 'Open Sans';
padding:0;
margin:0;
}
body a {
text-decoration:none;
}
body img {
border: none;
}
.menu {
position: fixed;
top: 0;
height: 80px;
z-index: 1000;
background-color: #f2f2f2;
}
.menu img {
float:left;
margin: 15px 0px 0px 20px;
height: 70%;
}
.menu .menu-link {
float:right;
}
.menu .menu-link a {
line-height: 100px;
color: #00497e;
text-transform:uppercase;
font-size: 11pt;
}
.menu .menu-link a:hover {
border: 0;
background-color: #e20613;
color: white;
}
<div id="wrap">
<div class="menu">
<a href="#">
<img alt="Logo" src="http://inpartsaudebi.com.br/assets/img/brand-inpart.png">
</a>
<div class="menu-link">
<a href="#about" id="menuAbout">
<img src="https://static.dentaldepartures.com/places/fa-building-o.png" style="width:5%;" />
Empresa
</a>
<a href="#users" id="menuUser">
<img src="http://alumnes.org/wp-content/uploads/2017/06/fa-user-circle-o-c0a2bd7a.png" style="width:5%;" />
Usuário
</a>
</div>
</div>
</div>
This is wrong width:100%-1; has to be width:Calc(100% - 1px); where this 1px can be any REM, EM measure, %
– hugocsl
Thanks for the info, I changed the code to calculate the
width
correctly.– Caique Romero