其中有一个名为SHOP的段落,它将作为动画从左向右移动 但有了这一切,像**家、产品、关于、联系**一切都在从右向左移动,我想阻止它们移动,除了SHOP 超文本标记语言代码

<!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" />
    <link rel="stylesheet" href="./styles.css" />
    <title>Hasgu</title>

    <script
      src="https://kit.fontawesome.com/e5e83f9d84.js"
      crossorigin="anonymous"
    ></script>
  </head>
  <body>
    <nav class="navbar">
      <a href="#"><p class="name">SHOP</p></a>
      <a href="">Home</a>
      <a href="">Products</a>
      <a href="">About</a>
      <a href="">Contact</a>
      <input type="search" class="searchbar" placeholder="Search" required />
      <button type="submit" class="fas fa-search"></button>
    </nav>
  </body>
</html>

CSS

* {
  margin: 0;
}

.navbar {
  font-family: monospace;
  font-size: 1.3rem;
  padding: 1%;
  background-color: rgb(235, 178, 178);
}

.navbar a {
  margin-left: 1.5%;
  text-decoration: none;
  color: black;
  padding: 0.6%;
}

.navbar a:not(.name):hover {
  animation: none; /* Disable animation for all links except the "HASGU" element */
}


.searchbar {
  margin-left: 600px;
  padding: 10px;
  text-align: left;
  width: 500px;
  height: 10%;
  color: #fff;
  font-size: 17px;
  border: black;
  font-weight: 500;
  background: black;
  border-radius: 10px;
}

.navbar button {
  height: 10%;
  border-radius: 10px;
  padding: 10px;
  color: white;
  font-size: 17px;
  background: black;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.name {
  margin-top: 2px;
  margin-bottom: 0px;
  display: inline-block;
  font-size: 1.2em;
  color: black;
  background-color: rgb(235, 178, 178);
  padding: 0px;
  letter-spacing: 1px;
  font-family: monospace;
  border-right: 5px solid;
  width: 73px;
  white-space: nowrap;
  overflow: hidden;
  animation: typing 2s steps(5), cursor 0.4s step-end infinite alternate;
}

@keyframes cursor {
  50% {
    border-color: transparent;
  }
}

@keyframes typing {
  from {
    width: 0;
  }
}

有没有人能帮我这个忙,谢谢

请帮我渡过难关

推荐答案

您可以对.name元素使用WRAPPER:

<nav class="navbar">
  <div class="wrapper">
      <a href="#"><p class="name">SHOP</p></a>
  </div>
  <a href="">Home</a>
  <a href="">Products</a>
  <a href="">About</a>
  <a href="">Contact</a>
  <input type="search" class="searchbar" placeholder="Search" required />
  <button type="submit" class="fas fa-search"></button>
</nav>


* {
  margin: 0;
}

.navbar {
  font-family: monospace;
  font-size: 1.3rem;
  padding: 1%;
  background-color: rgb(235, 178, 178);
}

.navbar a {
  margin-left: 1.5%;
  text-decoration: none;
  color: black;
  padding: 0.6%;
}

.navbar a:not(.name):hover {
  animation: none; /* Disable animation for all links except the "HASGU" element */
}


.searchbar {
  margin-left: 600px;
  padding: 10px;
  text-align: left;
  width: 500px;
  height: 10%;
  color: #fff;
  font-size: 17px;
  border: black;
  font-weight: 500;
  background: black;
  border-radius: 10px;
}

.navbar button {
  height: 10%;
  border-radius: 10px;
  padding: 10px;
  color: white;
  font-size: 17px;
  background: black;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.name {
  margin-top: 2px;
  margin-bottom: 0px;
  display: inline-block;
  font-size: 1.2em;
  color: black;
  background-color: rgb(235, 178, 178);
  padding: 0px;
  letter-spacing: 1px;
  font-family: monospace;
  border-right: 5px solid;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  animation: typing 2s steps(5), cursor 0.4s step-end infinite alternate;
}

.wrapper {
  display: inline-block;
  width: 73px;
}

@keyframes cursor {
  50% {
    border-color: transparent;
  }
}

@keyframes typing {
  from {
    width: 0;
  }
}

Html相关问答推荐

将容器水平偏离中心放置在桌面上;在移动设备上平稳地集中缩小规模

从网络抓取中提取文本

电话号码验证器(Angular )

Angular 15 p-对话框不使用组件 Select 器呈现HTML

页脚与主要内容重叠

调整一组IMG的大小以适应容器DIV

assets资源 净值元素不会扩展到涵盖子项

使具有FLEX父项的溢出自动的子元素收缩

carousel 的垂直滚动按钮居中

如何在VB.NET中用打印预览和直接打印的方式在Html中打印数据表的内容,包括页眉/设置纸张/方向/适合页面/总计

有没有一种方法可以提高代码中tailwind 类名的可读性?

HTML,CSS-阻止按钮在单击时向上移动

网格中的图像zoom 不正确

如何将 元素与常规文本垂直对齐

伪元素:after和溢出隐藏

使用 TailwindCSS 将徽标放在左上角,将菜单放在右上角

Css 左属性问题

我如何使用 HTML 和 CSS 在我的下拉菜单中获得这种类型的样式

文本输入在 Chrome 中保持水平滚动,带有文本溢出:省略号

在 Vue 3 中使用 JavaScript 数组显示 FontAwesome 图标