为什么文本阴影在鼠标悬停时不起作用



我编写了这段代码。将鼠标悬停时,类 toptext 下的元素应该会得到阴影。但它不起作用。我检查了拼写错误或其他问题。找不到。 悬停时应显示文本阴影。但它不起作用。知道为什么吗?

.toptext {
color: darkblue;
text-decoration: none;
font-size: 30;
padding: none;
transition: 0.5s;
}
.toptext:hover {
color: darkcyan;
text-shadow: 2px, 2px, 5px fuchsia;
}
<html>
<head>
<link rel="stylesheet" href="Style.css">
<h1 id="name">ASEF DIAN</h1>
</head>
<body>
<div id="top">
<a href="" class="toptext">Skills</a>
<a href="" class="toptext">Works</a>
<a href="" class="toptext">Contact</a>
</div>
</body>
</html>

我认为你的代码是错误的。 你找这样的东西? 顺便说一句,您可以使用 https://css3gen.com/text-shadow/发布正确的 TXT 阴影代码。

.toptext {
color: darkblue;
text-decoration: none;
font-size: 30;
padding: none;
transition: 0.5s;
}
.toptext:hover {
color: red;
font-size:25px;
text-shadow: 2px 2px 5px fuchsia;
}
<html>
<head>
<link rel="stylesheet" href="Style.css">
<h1 id="name">ASEF DIAN</h1>
</head>
<body>
<div id="top">
<a href="" class="toptext">Skills</a>
<a href="" class="toptext">Works</a>
<a href="" class="toptext">Contact</a>
</div>
</body>
</html>

从文本阴影中删除逗号 (,(

.toptext {
color: darkblue;
text-decoration: none;
font-size: 30;
padding: none;
transition: 0.5s;
}
.toptext:hover {
color: red;
font-size:25px;
text-shadow: 2px 2px 5px fuchsia;
}
<html>
<head>
<link rel="stylesheet" href="Style.css">
<h1 id="name">ASEF DIAN</h1>
</head>
<body>
<div id="top">
<a href="" class="toptext">Skills</a>
<a href="" class="toptext">Works</a>
<a href="" class="toptext">Contact</a>
</div>
</body>
</html>

参考: https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow

删除文本阴影属性中的逗号。它必须是这样的:text-shadow: 2px 2px 5px fuchsia;

最新更新