未知的规则

当我将鼠标悬停在@property上方时,它也有一条黄色下划线,并且该属性没有位置.

我阅读了一些文档,无法找出我的错误:

@property --rotate {
  syntax: "<angle>";
  inherits: false;
  initail-value: 132deg;
}
:root {
  --card-height: 65vh;
  --card-width: calc(var(--card-height));
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding-top: 2rem;
  padding-bottom: 2rem;
  box-sizing: border-box;
  justify-content: center;
}

#hope {
  background: #191c29;
  width: var(--card-width);
  height: var(--card-height);
  padding: 3px;
  position: relative;
  border-radius: 6px;
  justify-content: center;
  align-items: center;
  text-align: center;
  display: flex;
  font-size: 3rem;
  color: rgb(88 199 25 /0%);
  cursor: pointer;
  font-family: cursive;
  margin-top: 350px;
}

#hope:hover {
  color: rgb(88 199 250 / 100%);
  transition: color 2s;
}

#hope:hover::before,
#hope:hover:after {
  animation: none;
  opacity: 0;
}

#hope::before {
  content: "";
  width: 104%;
  height: 102%;
  border-radius: 8px;
  background-image: linear-gradient(
    var(--rorare),
    #5ddcff,
    #3c67e3 43%,
    #4c00c2
  );
  position: absolute;
  z-index: -1;
  top: -1%;
  left: -2%;
  animation: spin 2.5s linear infinite;
}

#hope::after {
  position: absolute;
  content: "";
  top: calc(var(--card-height) / 10);
  left: 0;
  right: 0;
  z-index: -1;
  height: 100%;
  width: 100%;
  margin: 0 auto;
  transform: scale(0.8);
  filler: blur(calc(var(--card-height) / 6));
  background-image: linear-gradient(
    var(--rotate),
    #5ddcff,
    #3c67e3 43%,
    #4e00c2
  );
  opacity: 1;
  transition: opacity 0.5s;
  animation: spin 3.5s linear infinite;
}

@keyframes spin {
  0% {
    --rotate: 0deg;
  }
  100% {
    --rotate: 360deg;
  }
}

#believe {
  background: #3550ca;
  width: 250px;
  height: 100px;
  padding: 3px;
  position: relative;
  border-radius: 6px;
  justify-content: center;
  align-items: center;
  text-align: center;
  display: flex;
  font-size: 3rem;
  color: rgb(88 199 25 /0%);
  cursor: pointer;
  font-family: cursive;
  margin-top: 350px;
}

推荐答案

您拼错了初始值.虽然@属性定义中的未知属性值不会使定义的其余部分无效,但从W3开始,我们可以看到:

@属性规则需要语法和继承描述符;如果缺少其中一个,则整个规则无效,必须忽略.只有当语法是通用语法定义时,初始值描述符才是可选的,否则需要描述符;如果缺少,则整个规则无效,必须忽略.

您已经包含了语法和继承描述符.

但是,语法不是通用语法定义,因此必须包含初始值.

同时判断例如caniuse.com,因为目前某些浏览器上尚未实现@属性,尤其是FF和Safari.

Css相关问答推荐

Tailwind CSS group-hover不适用于自定义前置码

主dart 文件未加载Flutter Web

更改MAT-FORM-FIELD的CSS,使其在有Angular 的HTML中显示为普通文本框

显示Reaction组件上的问题.使用FlexBox时的意外大小

如何仅使用CSS Select 器根据列表中第n个项的子项属性 Select 该项

关闭Superset中的Deck.gl工具提示

如何取消 CSS 伪类中的属性设置?

为什么所有选项卡都没有显示在 React 的 MUI 选项卡组件中?

如何让我的注册按钮在我的网站上像球一样 skip ?

如何禁用 Angular Material Pagination 按钮的波纹效果?

tailwind 类的别名?

整个列的 CSS Grid Margin Top

BootStrap:右对齐嵌套手风琴

如何制作一个居中的标题样式,其中换行符将最长的行排列在底部

基于类的 CSS Select 器

CSS - 在 id 中 Select 类的语法

如何在需要时通过 HTTPS 包含 CSS 和 JS 文件?

悬停效果:展开底部边框

CSS过渡自动高度不起作用

CSS 否定伪类 :not() 用于父/祖先元素