Navbar underline animation continues and doesn't stop at the last letter of the word

25 Views Asked by At

this is my first website that me and my 2 other friends have created it is a project for about 2 weeks deadline

i wanted to know how can i say to the underline animation to stop at every last letter of the word on html i have added 3 classes the same name .animationNav so i can specificaly select what i want to change there is a dropdown menu for languages, having trouble to find a solution

/* reset */
* {
  font-size: 62.5%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  text-decoration: none;
  list-style: none;
}

/* generic */
html {
  background-color: #00040f;
  color: white;
  scroll-behavior: smooth;
}

h1,
h2,
h3,
h4,
a {
  font-family: "Maven Pro", sans-serif;
  color: white;
}

h4,
a {
  font-size: 2rem;
}

h1,
h2 {
  font-size: 7.2rem;
}

h3 {
  font-size: 4rem;
}

p {
  font-family: "Michroma", sans-serif;
  font-size: 2rem;
  color: white;
}

.container {
  max-width: 168rem;
  margin: 0 auto;
}

.buttonBuy {
  padding: 2.4rem 11rem;
  background-color: #dbc441;
  font-size: 3.5rem;
  font-weight: 700;
  border-radius: 1rem;
}

.tinySpace {
  margin-top: 10rem;
}

.spaceBetween {
  margin: 10rem auto;
}

/* menu deroulant */
:root {
  --hauteur-menu: 60px;
}

nav {
  width: 100%;
  font-size: 18px;
  position: sticky;
  top: 0;
}

nav > ul {
  display: flex;
  text-align: center;
  height: var(--hauteur-menu);
}

nav > ul > li {
  position: relative;
  height: 100%;
  flex: 1;
}

nav > ul > li > a {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

header nav > .animationNav::before {
  content: "";
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #ffffff;
  transform-origin: bottom right;
  transition: transform 0.25s ease-out;
}
header nav > .animationNav:hover::before {
  transform: scaleX(1);
  transform-origin: bottom left;
}
0

There are 0 best solutions below