Как сделать нижнее подчеркивание с анимацией

Рейтинг: 0Ответов: 1Опубликовано: 28.03.2023

подскажите как сделать нижнее подчеркивание с анимацией.Нужно чтоб оно начиналось с первой буквы и шла до последней,а не резко появлялась.Как на фото,но это линия идет дальше до конца.И подскажите как еще придать значения этому подчеркиванию:ширину,толщину и тд введите сюда описание изображения

![введите сюда описание изображения

* {
    margin: 0;
    padding: 0;
    font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}

.navbar {
    display: flex;
    margin-left: 200px;
  
}

.logo {
    padding: 0.9em;
}

.navlist a:hover {
    text-size-adjust: 8;
    background-size: 100% 2px;
    
}

.gorod:hover {
    color: #009999;
    transition: 0.8s;

}

.navlist a {
    display: flex;
    list-style: none;
    text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 2px;
  transition: background-size .3s;
}

.navbar img {
    width: 60px;
    height: auto;
    padding: 0.3em;
}


.navlist a {
    text-decoration: none;
    color: black;
    display: block;
    padding: 1.5em;
}

.gorod {
    padding: 1.5em;
}

.ficon {
    display: flex;
    margin-left: 200px;
}

.ficon a {
    text-decoration: none;
}

.heart {
    background-color: #8b8888;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    width:35px;
    height:35px;
    text-align:center;
    line-height:45px;
    text-decoration: none;
    transition: 0.8s;
    margin-top: 17px;
    display: flex;
    align-items: center;
}

#heart {
    font-size: 25px;
    text-decoration: none;
    color: black;
    transition: 0.8s;
    margin-left: 5px;
    margin-top: 15px;
}

#heart:hover {
    color:rgb(255, 255, 255);
}

.heart:hover {
    background-color: #f80909;
}

.theart span {
    color: black;
    transition: 0.8s;
    display: flex;   
    margin-left: 20px;
    justify-content: right;
    text-decoration: none;
    font-size: 17px;
    font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}

.ficon:hover .theart span {
  color: red;
  transition: 0.8s;
}

.theart span:hover {
    color: red;
}

.ficon:hover #heart {
    color: white;
}

.sicon {
    justify-content: right;
}

.bag {
    font-size: 25px;
    background-color: #8b8888;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    width:35px;
    height:35px;
    text-align:center;
    line-height:45px;
    text-decoration: none;
    transition: 0.8s;
    margin-top: 17px;
    display: flex;
    align-items: center;
    margin-left: 180px;
}



.bag>a {
    margin-top: 20px;
    font-size: 23px;
    text-decoration: none;
    color: black;
    transition: 0.8s;
    margin-left: 6px;
    margin-top: 3px;
}

#bag {
    transition: 0.8s;
}

.tbag a {
    font-size: 17px;
    display: flex;
    justify-content: right;
    margin-left: 15px;
    color: black;
    text-decoration: none;
    transition: 0.8s;
}

.bag:hover .tbag a {
    color:    #009999;
  }

#bag:hover {
    color:rgb(255, 255, 255);
}

.bag:hover #bag {
    color: white;
  }

.bag:hover {
    background-color: #009999;
}

.cover {
    position: relative;
}

.pcover img {
    position: absolute;
    width: 1920px;
    height: 890px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    z-index: -1;
}

.pcover img {
    
}

.tcover p {
    text-align: center;
    bottom: 200px;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flowers</title>  
    <link rel="stylesheet" href="static/styles/style.css">
    <link rel='stylesheet' href='https://cdn-uicons.flaticon.com/uicons-regular-rounded/css/uicons-regular-rounded.css'>
    <script src="https://kit.fontawesome.com/3929e16ef5.js" crossorigin="anonymous"></script>
    <script src="{% static 'network/functions.js' %}"></script>
    <link rel='stylesheet' href='https://cdn-uicons.flaticon.com/uicons-regular-rounded/css/uicons-regular-rounded.css'>
  </head>
<body>
    <div class="navbar">
        <div class="logo">
          <h1>VAFLOWER</h1>
        </div>

         <ul class="navlist" >

            <li><a href="">Доставка и оплата</a></li>
            <li><a href="">Условия возврата</a></li>
            <li><a href="">Отзывы</a></li>
            <li class="gorod">Уфа</li>
            <li class="nomer"><a href="">+7 (762) 283-93-88</a></li>
          </ul>

              
              <div class="ficon">
                <div class="heart">
                 <a href=""><i id="heart" class="far fa-heart"></i></a>
          <a class="theart" href="" ><span>Избранное</span></a>
              </div>
              </div>

          <div class="bag">
            <a href=""><i id="bag" class="fi fi-rr-shopping-bag"></i></a>
            <span class="tbag"><a href="">Корзина</a></span>             
        </div>
            </div>
            <div class="cover">
              <div class="pcover">
                <img src="static/images/cover.jpg" alt="">
              </div>
              <div class="tcover">
                <p>Интернет-магазин Vaflower -
                </br>
                быстрая доставка цветов по Уфе,
              </br>
              а так же самое лучшее качество цветов
                </p>
                <p>Свежесрезанные цветы для любого праздника и повода
                </br>
                Быстрая доставка от 1 до 2 часов
                </p>
              </div>
            </div>
       
         
            </div>
          
      </div>
    </div>

    
</body>
</html>

Ответы

▲ 0

Такое "подчеркивание" можно реализовать таким образом...

* {
  margin: 0;
  padding: 0;
  font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}

.navbar {
  display: flex;
  margin-left: 200px;
}

.logo {
  padding: 0.9em;
}

.navlist a:hover span {
  text-size-adjust: 8;
  background-size: 100% 2px;
}

.gorod:hover {
  color: #009999;
  transition: 0.8s;
}

.navlist a {
  display: flex;
  list-style: none;
  text-decoration: none;
}

.navlist a span {
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 2px;
  transition: background-size .3s;
}

.navbar img {
  width: 60px;
  height: auto;
  padding: 0.3em;
}

.navlist a {
  text-decoration: none;
  color: black;
  display: block;
  padding: 1.5em;
}

.gorod {
  padding: 1.5em;
}

.ficon {
  display: flex;
  margin-left: 200px;
}

.ficon a {
  text-decoration: none;
}

.heart {
  background-color: #8b8888;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
  width: 35px;
  height: 35px;
  text-align: center;
  line-height: 45px;
  text-decoration: none;
  transition: 0.8s;
  margin-top: 17px;
  display: flex;
  align-items: center;
}

#heart {
  font-size: 25px;
  text-decoration: none;
  color: black;
  transition: 0.8s;
  margin-left: 5px;
  margin-top: 15px;
}

#heart:hover {
  color: rgb(255, 255, 255);
}

.heart:hover {
  background-color: #f80909;
}

.theart span {
  color: black;
  transition: 0.8s;
  display: flex;
  margin-left: 20px;
  justify-content: right;
  text-decoration: none;
  font-size: 17px;
  font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}

.ficon:hover .theart span {
  color: red;
  transition: 0.8s;
}

.theart span:hover {
  color: red;
}

.ficon:hover #heart {
  color: white;
}

.sicon {
  justify-content: right;
}

.bag {
  font-size: 25px;
  background-color: #8b8888;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
  width: 35px;
  height: 35px;
  text-align: center;
  line-height: 45px;
  text-decoration: none;
  transition: 0.8s;
  margin-top: 17px;
  display: flex;
  align-items: center;
  margin-left: 180px;
}

.bag>a {
  margin-top: 20px;
  font-size: 23px;
  text-decoration: none;
  color: black;
  transition: 0.8s;
  margin-left: 6px;
  margin-top: 3px;
}

#bag {
  transition: 0.8s;
}

.tbag a {
  font-size: 17px;
  display: flex;
  justify-content: right;
  margin-left: 15px;
  color: black;
  text-decoration: none;
  transition: 0.8s;
}

.bag:hover .tbag a {
  color: #009999;
}

#bag:hover {
  color: rgb(255, 255, 255);
}

.bag:hover #bag {
  color: white;
}

.bag:hover {
  background-color: #009999;
}

.cover {
  position: relative;
}

.pcover img {
  position: absolute;
  width: 1920px;
  height: 890px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  z-index: -1;
}

.pcover img {}

.tcover p {
  text-align: center;
  bottom: 200px;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Flowers</title>
  <link rel="stylesheet" href="static/styles/style.css">
  <link rel='stylesheet' href='https://cdn-uicons.flaticon.com/uicons-regular-rounded/css/uicons-regular-rounded.css'>
  <script src="https://kit.fontawesome.com/3929e16ef5.js" crossorigin="anonymous"></script>
  <script src="{% static 'network/functions.js' %}"></script>
  <link rel='stylesheet' href='https://cdn-uicons.flaticon.com/uicons-regular-rounded/css/uicons-regular-rounded.css'>
</head>

<body>
  <div class="navbar">
    <div class="logo">
      <h1>VAFLOWER</h1>
    </div>

    <ul class="navlist">

      <li><a href=""><span>Доставка и оплата<span></a></li>
      <li><a href=""><span>Условия возврата<span></a></li>
      <li><a href=""><span>Отзывы<span></a></li>
      <li class="gorod">Уфа</li>
      <li class="nomer"><a href=""><span>+7 (762) 283-93-88<span></a></li>
    </ul>


    <div class="ficon">
      <div class="heart">
        <a href=""><i id="heart" class="far fa-heart"></i></a>
        <a class="theart" href=""><span>Избранное</span></a>
      </div>
    </div>

    <div class="bag">
      <a href=""><i id="bag" class="fi fi-rr-shopping-bag"></i></a>
      <span class="tbag"><a href="">Корзина</a></span>
    </div>
  </div>
  <div class="cover">
    <div class="pcover">
      <img src="static/images/cover.jpg" alt="">
    </div>
    <div class="tcover">
      <p>Интернет-магазин Vaflower -
        </br>
        быстрая доставка цветов по Уфе,
        </br>
        а так же самое лучшее качество цветов
      </p>
      <p>Свежесрезанные цветы для любого праздника и повода
        </br>
        Быстрая доставка от 1 до 2 часов
      </p>
    </div>
  </div>


  </div>

  </div>
  </div>


</body>

</html>