gpt4 book ai didi

html - 验证(CSS 3.0): "var (--my-border-top)" is not valid value for the "border-top" property

转载 作者:行者123 更新时间:2023-11-28 15:56:55 25 4
gpt4 key购买 nike

我在 css 中使用自定义属性,

出现以下错误

验证(CSS 3.0):“var (--my-border-top)”不是“border-top”属性的有效值

我的CSS是

<style>
.samara {
width: 100px;
height: 100px;
position: relative;
border: 1px solid black;
border-top: var(--my-border-top);
}
</style>

<html>
<div class="samara" style="--my-border-top: 7px solid green;"></div>
</html>

它在 jsfiddle 中工作正常,但在我的元素中它显示错误...我该如何纠正它...请帮助我

最佳答案

看起来您正在使用 Visual Studio 附带的 CSS 验证器(没有其他验证器将其称为“CSS 3.0”)。

该验证器不支持自定义属性或 var()。别担心。其实我推荐disabling CSS validation in Visual Studio altogether .

关于html - 验证(CSS 3.0): "var (--my-border-top)" is not valid value for the "border-top" property,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48767200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com