我做了这个代码。 类toptext下的元素在悬停时应获得阴影。 但它不起作用。 我检查了错别字或其他问题。 找不到。 文本阴影应该显示在悬停。 但它不起作用。 知道为什么吗?
null
.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>
null
我觉得你的代码错了。 你在找这样的东西吗? 顺便说一句,您可以使用https://css3gen.com/text-shadow/来发布正确的txt阴影代码。
null
.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>
删除text-shadow属性中的逗号。 它必须类似:text-shadow:2px 2px 5px fuchsia;
从文本阴影中删除逗号(,)
null
.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>