CSS Box阴影在我不希望的时候在单词上使用阴影

问题描述 投票:0回答:1

我对编码有点陌生,但是在向导航栏添加框阴影时,它也会为#href链接提供阴影。我不希望单词有阴影,只是在导航栏的底部。

body {
  background-color: grey;
  font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--main-white);
}

#nav {
  display: flex;
  justify-content: flex-end;
  z-index: 1;
  padding: 10px 25px 10px 10px;
  font-size: 35px;
  font-family: 'Poppins', sans-serif;
  color: #ffa2ae;
  box-shadow: 0 2px rgba(0, 0, 0, 0.4);
  text-decoration: none;
}

#nav {
  background: #81f7ff;
}

*, *::before, *::after {
    box-sizing: inherit;
  * {
    margin: 0;
    padding: 0
  }

Here is what it looks like with the current CSS:

html css box-shadow
1个回答
0
投票

看起来像这样,因为如果您查看HTML文件,则字体/ href位于导航栏标签中,因此文本会从导航栏中获取阴影。尝试在css文件中添加href(或HTML文件中的h1或bzw),并将其中的阴影设置为0或不设置。

© www.soinside.com 2019 - 2024. All rights reserved.