3-30作业检查
来源:3-30 编程练习
ychao2
2022-10-11 01:06:36
相关截图:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>动态伪类</title> <style> /* 鼠标悬停输入框变为红色 */ input:hover { border: 1px solid red; } /* 焦点在用户名输入框背景颜色为橘色 */ .name input:focus{ background-color: orange; } /* 焦点在密码输入框背景颜色为黄色 */ .password input:focus{ background-color: yellow; } </style> </head> <body> <p class="name">用户名:<input type="text"></p> <p class="password">密码:<input type="password"></p> </body> </html>
1,请问老师代码是否还能在优化或有更好的写法
2,请问老师:focus聚焦后这个黑色的外边框应该如何设置修改呢
1回答
好帮手慕小李
2022-10-11
同学你好,代码可以实现需求,不需要再做优化了。关于focus聚焦的黑框,是input的默认样式。如想通过focus聚焦时取消到边框那么就要在之前就做清除默认样式。如下仅作为参考:
同学自己试试,祝学习愉快!
相似问题