Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
CSS3 Slight indentation when hovering over a nav item

When I hover over the main Icon of the first ul of my nav part, the dropdown menu appears in perfect location, however, when I hover over the sub menu items, a slight indentation appears that I can't seem to find the cause for.

Hovering over the three dots "..." icon:

Hovering over the three dots "..." icon

Hovering over the sub item of the menu:

Hovering over the sub item of the menu

you can clearly see the indentation when I hover over the sub menu which I colored violet upon hover over, which is exactly when the indentation will occur.

.main-navigation {
  position: absolute;
  right: 0px;
  margin-top: -20px;
  margin-right: 15px;
  width: 2em;
  height: 2em;
  color: #D9D9D9;
  border: 1px solid #D9D9D9;
  /* padding: auto; */
  align-content: center;
}

.firstLevelul{
  padding-left: 0;
  list-style: none;
  justify-content:flex-end;
}

.firstLevela{
  display: block;
  text-align: center;
  font: normal small-caps 100 20px/1.8em 'Helvetica Neue';
  text-decoration: none;
}

.firstLevela:hover{
  color: #D9D9D9;
  width: 1.5em;
  height: 1.5em;
}

.secondLevelul{
  display: none;
}

.secondLevela{
  display: block;
}

.secondLevelli:hover{
  background-color: violet;
}

.firstLevelli:hover > .secondLevelul{
  display: block;
  width: 200px;
  height: 200px;
  background-color: white;
  border: 1px solid #D9D9D9;
  margin-left: -169px;
}
<nav class="main-navigation">
  <ul className="firstLevelul">
    <li className="firstLevelli">
      <a href="#" className="firstLevela"><MoreHorizIcon className="editDropDownIcon" /></a>
      <ul className="secondLevelul">
        <li className="secondLevelli"><a className="secondLevela" href="#">sub menu</a></li>
        <li className="secondLevelli"><a className="secondLevela" href="#">sub menu</a></li>
        <li className="secondLevelli"><a className="secondLevela" href="#">sub menu</a></li>
      </ul>
    </li>
  </ul>
</nav>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This was a little hard to work with as you didn't provide much code.

But I believe the issue is based on your height: 1.5em in the firstLevela:hover selector in CSS.

I made this incredibly rudimentary JSFiddle to demonstrate

https://jsfiddle.net/t7gj9qx2/

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!