博客列表 >CSS:表单伪类-复习

CSS:表单伪类-复习

异乡客
异乡客原创
2022年05月10日 10:30:27734浏览
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>表单伪类</title>
  8. </head>
  9. <body>
  10. <!--
  11. 伪类:
  12. 1.结构伪类:根据元素位置获取元素
  13. 2.状态伪类:根据状态来获取元素 -->
  14. <ul class="list">
  15. <li class="first">item1</li>
  16. <li>item2</li>
  17. <li>item3</li>
  18. <li>item4</li>
  19. <li>item5</li>
  20. <li>item6</li>
  21. <li>item7</li>
  22. <li>item8</li>
  23. </ul>
  24. <input type="text">
  25. <input type="text" disabled>
  26. <input type="radio" name="sex" id="m" value="0"><label for="m"></label>
  27. <input type="radio" name="sex" id="f" value="0"><label for="f"></label>
  28. <p>
  29. <button>提交</button>
  30. </p>
  31. <style>
  32. input:disabled{
  33. background-color: yellow;
  34. }
  35. input:enabled{
  36. background-color: cyan;
  37. }
  38. input:checked + label {
  39. color:red;
  40. }
  41. button {
  42. width:100px;
  43. height:30px;
  44. border: none;
  45. outline: none;
  46. background-color: seagreen;
  47. color:white;
  48. }
  49. button:hover{
  50. background-color: coral;
  51. cursor: pointer;
  52. }
  53. input:focus{
  54. background-color: red;
  55. }
  56. </style>
  57. </body>
  58. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议