简体   繁体   中英

Anchored links(“ ul li a”) when hovering

I'm trying to stop moving objects when hovering.

See what i'm doing here > JSFIDDLE

When hovering the second link (TEST2), it changes to bold property (need to be), but it pushes the other button (TEST) to the left. How can i anchor other elements in the header and stop their movement?

give an item class to normal list elements and seperator class to seperator list element

<div class="header-bg">
  <div class="container">
    <div class="menu-header">
      <nav>
        <ul>
          <li class="item"><a href="#">Test</a></li>
          <li class="seperator"><span>&there4;</span></li>
          <li class="item"><a href="#">Test2</a></li>
        </ul>
      </nav>
    </div>
  </div>
</div>

and give a fixed width to list elements at .item class

.item {
    width:70px;
}

working demo

给他们一个固定的宽度,即width:80px

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM