I'm trying to create a responsive layout button that looks like this:
But the problem is that I'm not being able to create the three horizontal lines, only one of them. Staying this way:
My code:
HTML
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
CSS
.navbar-toggler {
position: relative;
float: right;
width: 40px;
height: 40px;
margin-top: 5px;
margin-right: 5px;
cursor: pointer;
z-index: 99999;
}
.navbar-toggler span {
height: 4px;
background: #545454;
transition: 0.2s all;
}
.navbar-toggler span:before, .navbar-toggler span:after {
content: "";
display: block;
}
You can use the HTML unicode ☰
for hamburger icon
You can find more at here: https://www.w3schools.com/charsets/ref_utf_symbols.asp
.navbar-toggle
{
font-size:25px;
background:none;
border:none;
}
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">☰
</button>
You can also animate the icon see: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_menu_icon_js