I have a Menu toggle icon in top Navbar which is refusing to float left.
header {
position: fixed;
right: 0;
top: 0;
left: 0;
z-index: 100;
height: 60px;
box-shadow: 0px 5px 5px -5px rgb(0 0 0 /10%);
background-color: #2980b9;
transition: left 300ms;
}
.header-content {
display: flex;
align-items: center;
height: 100%;
/* justify-content: space-between; */
}
.dropdown {
display: flex;
position: relative;
align-items: center;
justify-content: right;
padding: 4px;
margin: 0px 15px;
width: 100%;
border: 1px solid #5499c7;
}
.dropdown a,
label {
color: #fff;
position: relative;
Padding: 2px 4px;
background: #5499c7;
}
.dropdown a {
font-size: 1.6rem;
margin-left: 1.4rem;
border-radius: 50%;
}
.dropdown label {
font-size: 1.6rem;
text-align: left;
margin: 0rem;
cursor: pointer;
float: left;
}
<link rel="stylesheet" href="https://maxst.icons8.com/vue-static/landings/line-awesome/line-awesome/1.3.0/css/line-awesome.min.css">
<header>
<div class="header-content">
<div class="dropdown">
<label for="menu-toggle">
<span class="las la-bars"></span>
</label>
<a href="#">
<span class="las la-home"></span>
</a>
<a href="#">
<span class="las la-envelope"></span>
</a>
<a href="#">
<span class="las la-bell"></span>
</a>
<a href="#">
<span class="las la-user"></span>
</a>
</div>
</div>
</header>
As you can see the picture below: (marked red arrow line)
I want all Navbar items float right except toggle-menu icon bar which is span
Anyone can help i appreciate.
I tried floating left, but it refuses
3
Answers
Have a lot of solutions to do it, this is a suggestion:
CSS
HTML
You can add
flex-gorw:1;
on toggle btn.Because you hava background color on
label
, I wraplabel
byspan
so the transparentspan
will fill the space.I would suggest wrapping the
a
tags in anav
element, and usingjustify-content: space-between
on.dropdown
rather thanjustify-content: right