Blogger Information
Blog 21
fans 0
comment 0
visits 9991
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1021 实例演示表单中常用的"状态伪类",盒模型的五个核心属性,并描述padding,margin的简记规则
放手去爱
Original
289 people have browsed it
  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. <link rel="stylesheet" href="1021-01css.css" />
  9. <style>
  10. /**------------------------------------------------------------------------
  11. * ! 状态伪类
  12. *------------------------------------------------------------------------**/
  13. fieldset {
  14. display: inline-grid;
  15. gap: 1em;
  16. border-radius: 10px;
  17. padding: 1em 2em;
  18. color: #18201e;
  19. background: linear-gradient(to left top, #097865);
  20. }
  21. fieldset legend {
  22. text-align: center;
  23. }
  24. fieldset input {
  25. padding: 5px;
  26. border: none;
  27. border-bottom: #18201e 1px solid;
  28. }
  29. /*
  30. ! 状态伪类
  31. ? 匹配获取焦点 input:focus
  32. */
  33. fieldset input:focus {
  34. background-color: lightgreen;
  35. transition: 0.45s;
  36. }
  37. input[type="checkbox"]:checked + label {
  38. color: red;
  39. }
  40. /*
  41. ? 当鼠标悬停在某个元素上的效果
  42. */
  43. button {
  44. border: none;
  45. background: lightgreen;
  46. color: white;
  47. padding: 5px 10px;
  48. letter-spacing: 1em;
  49. }
  50. button:hover {
  51. cursor: pointer;
  52. border: none;
  53. background: #a3ee90;
  54. color: #706f6f;
  55. padding: 5px 10px;
  56. letter-spacing: 1em;
  57. opacity: 0.85;
  58. }
  59. /* 被禁用元素 */
  60. fieldset :disabled {
  61. background: #3bcca8;
  62. color: azure;
  63. }
  64. /**========================================================================
  65. * ! 盒模型
  66. * ? 属性有 width, height, padding, margin, border, box-sizing
  67. *========================================================================**/
  68. /* 四值方法 上,右,下,左 */
  69. padding: 5px 10px 15px 20px;
  70. /* 三值方法 上 ,左右,下*/
  71. padding: 5px 10px 15px;
  72. /* 双值 上下 左右 */
  73. padding: 5px 10px;
  74. /* 单值 上下左右全相等 */
  75. padding: 10px;
  76. /* 三值,双值记忆方法:只要出现在第二个参数位置上,就必然代表左右 */
  77. /* margin 和 padding 是一样的,
  78. border 是不存在以上的简化缩写的,border 是可见的
  79. */
  80. .box {
  81. width: 300px;
  82. height: 260px;
  83. border: #097865 double 5px;
  84. text-align: center;
  85. padding: 20px 10px 12px 15px;
  86. margin: 8px 12px 13px 15px;
  87. box-sizing: border-box;
  88. }
  89. </style>
  90. </head>
  91. <body>
  92. <!-- ! 状态伪类 -->
  93. <form action="">
  94. <fieldset>
  95. <legend>用户注册</legend>
  96. <input
  97. type="text"
  98. id="username"
  99. name="username"
  100. placeholder="用户名"
  101. required
  102. autofocus
  103. />
  104. <input
  105. type="email"
  106. id="useremail"
  107. name="useremail"
  108. placeholder="电子邮箱"
  109. required
  110. disabled
  111. />
  112. <input
  113. type="password"
  114. id="userpass"
  115. name="userpass"
  116. placeholder="用户密码"
  117. required
  118. />
  119. <!-- 默认被选中 -->
  120. <input type="checkbox" id="rem" name="rem" checked />
  121. <label for="rem">记住我</label>
  122. <button type="submit">提交</button>
  123. </fieldset>
  124. </form>
  125. <!-- ! 盒模型 -->
  126. <div class="box">盒模型</div>
  127. </body>
  128. </html>
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:总结的不错
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post