Home > Enterprise >  Unknown at rule @propertycss(unknownAtRules)
Unknown at rule @propertycss(unknownAtRules)

Time:06-08

Unknown at rule @propertycss(unknownAtRules)

When I hover over the @property, it also has a yellow underline and the property isn't taking a place.

I read some documentation and can't figure out what I have wrong:

@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;
}

CodePudding user response:

You have misspelled initial-value. Although an unknown property value in an @property definition does not invalidate the rest of the definition, from W3 we see:

@property rules require a syntax and inherits descriptor; if either are missing, the entire rule is invalid and must be ignored. The initial-value descriptor is optional only if the syntax is the universal syntax definition, otherwise the descriptor is required; if it’s missing, the entire rule is invalid and must be ignored.

You have included a syntax and inherits descriptor.

However, the syntax is not the universal syntax definition so you must include initial-value.

Also check e.g. caniuse.com because @property is not currently implemented on some browsers, most notably at this time FF and Safari.

  • Related