2-17为什么两个框的hover一起设置,用户名框鼠标移开后还是红色?
来源:2-17 编程练习
慕妹2075046
2019-06-19 23:23:56
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>动态伪类</title>
<style type="text/css">
.user input, .password input:hover{border-color:red;}
两个input一起写用户名框鼠标移开后还是红色,分开写就和效果图一样,哪里写错了?
.user input:focus{background:orange;}
.password input:focus{background:yellow;}
</style>
</head>
<body>
<a class="user">用户名:<input type="text"/></a>
<a class="password">密码:<input type="password"/><a>
</body>
</html>
1回答
好帮手慕言
2019-06-20
同学你好,多个选择器一起写时,中间是使用输入法在英文状态下的逗号分隔开。用户名input标签后面也是要加hover的。
正确写法应该是:
另外老师使用同学提供的代码并没有出现同学所说的情况,建议同学再测试下
祝学习愉快~
相似问题