I'm trying to figure out how to get this symbol on my webpage:
What is the symbol called? Is there a way to get it on my webpage like there is to get the ▾ by using
▾
Thank you in advance.
I'm trying to figure out how to get this symbol on my webpage:
What is the symbol called? Is there a way to get it on my webpage like there is to get the ▾ by using
▾
Thank you in advance.
This is a so-called "hamburger menu".
The closest HTML entity you can get is ≡, bold ≡ ≡
or ≡
, supported almost everywhere.
There is also ☰ ☰
, but it is less supported, in particular it is not available on Android.
It can be enough for a small icon, and if you need a bigger one, here is a pure CSS implementation:
.ham-menu { display: inline-block; position: relative; margin: 35px 0; } /* margin = (width-height)/2 */
.ham-menu, .ham-menu::before, .ham-menu::after { width: 100px; height: 20px; border-radius: 7px; background-color: black; }
.ham-menu::before, .ham-menu::after { content: ""; display: block; position: absolute; }
.ham-menu::before { bottom: 130%; } .ham-menu::after { top: 130%; }
<span class="ham-menu"></span>
All the ways provided in the link in comment are great. but there is also a way not described there, the same as bootstrap is using too. The preference of this method is because it is pure CSS animatable.
<div class="menu-icon">
<span class="line"></span>
<span class="line"></span>
<span class="line"></span>
</div>
.menu-icon > .line {
background-color: #292929;
height: 2px;
display: block;
}
.menu-icon > .line + .line {
margin-top: 8px;
}
You can find the unicode & html entity codes here: https://graphemica.com/%E2%98%B0
Or just copy & paste this simple symbol: ☰
you can use font awesome
<button class="btn"><i class="fa fa-bars"></i></button>
the css part
.btn {
border: none;
background-color: ghostwhite;
color: black;
font-size: 30px;
cursor: pointer;
}
to either expand on click you might need some javascript select using classes
const closeBtn = document.querySelector(".btn");
const sidenav = document.querySelector(".sidenav");
const closeSideNav = document.querySelector(".closeSideNav");
closeBtn.addEventListener("click", function() {
sidenav.classList.remove("hidden");
});