# Nav-bar with flexbox and moving elements when hover

**URL:** <https://forum.freecodecamp.org/t/nav-bar-with-flexbox-and-moving-elements-when-hover/252148>\
**Category:** General\
**Created:** [January 17, 2019, 12:07pm UTC](https://forum.freecodecamp.org/t/nav-bar-with-flexbox-and-moving-elements-when-hover/252148 "2019-01-17T12:07:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cvp](https://avatars.discourse-cdn.com/v4/letter/c/a5b964/32.png) [@cvp](https://forum.freecodecamp.org/u/cvp)\
**Post date:** [January 17, 2019, 12:07pm UTC](https://forum.freecodecamp.org/t/nav-bar-with-flexbox-and-moving-elements-when-hover/252148/1 "2019-01-17T12:07:55Z")

</div>

I have problem with my navigation bar. I wanted to create elements with border-bottom and when i will hover on it I want to increase large of border-bottom, but when I hover on it element is moving himself and another elements too. How can i solve this  
problem? Maybe flexbox is not the best option to create navigation and I should take other method?

Here is my codepen: [https://codepen.io/cvp/pen/MZdJYX](https://codepen.io/cvp/pen/MZdJYX)

---

<div class="post-metadata">

**Author:** ![elsalvadordali](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/elsalvadordali/32/108326_2.png) [@elsalvadordali](https://forum.freecodecamp.org/u/elsalvadordali)\
**Post date:** [January 17, 2019, 12:54pm UTC](https://forum.freecodecamp.org/t/nav-bar-with-flexbox-and-moving-elements-when-hover/252148/2 "2019-01-17T12:54:31Z")

</div>

Your padding is causing it to shift. When you only have two values (5px 10px) the first value is the x coordinate. It moves your element up/down. The second value moves them from side to side. So just change that and it shouldn’t move.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:06pm UTC](https://forum.freecodecamp.org/t/nav-bar-with-flexbox-and-moving-elements-when-hover/252148/3 "2021-01-17T20:06:15Z")

</div>

Closed on January 17, 2021, 8:06pm UTC


