我已经制作了一个按钮,但对我来说这还不够好,我想让它在鼠标指针悬停在它上面时改变它的属性。我试过了:
a:hover #button {
text-decoration:underline;
}
以及:
a:hover input {
text-decoration:underline;
}
HTML:
<!DOCTYPE HTML>
<html>
<head>
<title>Sign-In</title>
<link rel='stylesheet' type='text/css' href='stylesheet.css'/>
<script type="text/javascript" src="script.js"></script>
</head>
<body id="body-color">
<h1 id="heading">Welcome to the Intarnet.</h1>
<hr style="color:#E6B636">
<div id="Sign-In">
<center><legend>Please enter your username and password.</legend></center>
<hr style="color:#E6B636">
<form method="POST" action="connectivity.php">
Username: <br><input type="text" name="user" size="40"><br>
Password: <br><input type="password" name="pass" size="40"><br><br>
<input id="button" type="submit" name="submit" value="Log-In">
</form>
</div>
</body>
</html>
-Trey
答案 0 :(得分:6)
它很简单:
input[type=submit]:hover{
text-decoration:underline;
}
您希望定位按钮(可以直接使用#button
或使用上述内容定位所有submit
元素),然后在:hover
选择器上应用下划线