12

i have a issue in my website menu in android mobile chrome browser that is not able to show unicode ☰ . but if i am check my web application in iPhone or other android browser it is rendering or working properly.

I am used this icon in this structure

<ul>
    <li>&#9776;☰</li>
    <li>Home</li>
    <li>About Us</li>
</ul>

But it is not show in mobile chrome browser How to fix it!

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
Mohammed Javed
  • 866
  • 2
  • 9
  • 24

4 Answers4

8

The other alternative is to use &#8801; instead: it looks very similar:

≡ instead of ☰

Sergey Mashkov
  • 4,630
  • 1
  • 27
  • 24
6

We can also create hamburger/menu icon using some CSS and HTML stuff that works fine on all versions of browsers without making any break. It works fine on all mobile and desktop browsers.

.hamburger-icon {
    margin: 0;
    padding: 19px 16px;
    display: inline-block;
    position: absolute;
    top: 0;
    left: 0;
}
.hamburger-icon span {
    width: 40px;
    background-color: #000;
    height: 5px;
    display: block;
    margin-bottom: 6px;
}
.hamburger-icon span:last-child {
    margin-bottom:0px;
}
<label class="hamburger-icon">
    <span>&nbsp;</span>
    <span>&nbsp;</span>
    <span>&nbsp;</span>
</label>
TylerH
  • 20,799
  • 66
  • 75
  • 101
Mohammed Javed
  • 866
  • 2
  • 9
  • 24
3

Apparently the reason is that no font in the system where the browser runs contains a glyph for “☰” U+2630 TRIGRAM FOR HEAVEN.

The alternatives are:

  • Use an image instead.
  • Use a downloadable font with @font-face. This may mean that a few megabytes need to be loaded in the user’s system.

For general advice on such matters, see my Guide to using special characters in HTML.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
1

You could easily use three pipe characters | and rotate them 90degrees using the transform: rotate(90deg) function! Here's what I've done:

  <nav role="navigation" id="nav-hamburger-wrapper">
    <input type="checkbox" id="nav-hamburger-input"/>
    <label for="nav-hamburger-input">|||</label>
  </nav>

and in CSS:

#nav-hamburger-wrapper label,
#nav-hamburger-input {
  transform: rotate(90deg);
  transition-duration: 0.3s; /* give it a rotation effect when checked */
}
#nav-hamburger-wrapper input:checked + label {
  transform: rotate(0);
}

Enjoy ;-)

Pedram
  • 921
  • 1
  • 10
  • 17