Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Hamburger menu lines are not same height

I am trying to build a hamburger menu, however, the height of the individual menu lines is inconsistent. The middle line looks to be the actual height while the top and bottom appear smaller.

If I zoom in you can see:
Zoomed version of inconsistent hamburger menu lines.

A zoomed-out version looks like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Regular view of inconsistent hamburger menu lines.

.burger span {
  display: block;
  width: 32px;
  height: 2px;
  background-color: red;
}

.burger span:first-of-type {
  margin-bottom: 4px;
}

.burger span:last-of-type {
  margin-top: 4px;
}
<div class="burger">
  <span></span>
  <span></span>
  <span></span>
</div>

If I increase the height of the menu lines to 3px then the top and bottom lines will look larger. If I increase the height to 4px then they will maintain a consistent height. Any help as to why this may be.

>Solution :

Answer for future visitors (non-code related):

  1. If using a Windows machine, check the system display zoom settings. This is most likely the culprit – (this was the issue for this question)
  2. Check your browser zoom settings.

Code related:

  1. Use different measurement values – px, rem or em to test. May be a subpixel render issue.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading