Blogger Information
Blog 20
fans 0
comment 0
visits 8465
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1021作业
A 管志岗-电商策划
Original
518 people have browsed it

作业内容:

  1. 实例演示表单中常用的”状态伪类”, 尽量选择课堂上未提及的
  2. 实例演示盒模型的五个核心属性,并描述padding,margin的简记规则

1. 实例演示表单中常用的”状态伪类”

  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>状态伪类选择器-label+input表单</title>
  8. <link rel="stylesheet" href="/1021/demo2.css" />
  9. </head>
  10. <body>
  11. <form action="">
  12. <fieldset>
  13. <legend>用户注册</legend>
  14. <input type="text" id="" name="" placeholder="账号" />
  15. <input
  16. type="email"
  17. id=""
  18. name=""
  19. placeholder="邮箱"
  20. checked
  21. autofocus
  22. />
  23. <input type="password" id="" name="" placeholder="密码" checked />
  24. <!-- 第一种: -->
  25. <div class="div">
  26. <input class="checkbox" type="checkbox" id="" />
  27. <label>记住我(老师讲的这个可以)</label>
  28. </div>
  29. <!-- 第二种 label在前面不行: -->
  30. <div class="div2">
  31. <label for="checkbox_2">记住我(label和input前后位置互换不行)</label>
  32. <input class="checkbox_2" type="checkbox" id="checkbox_2" />
  33. </div>
  34. <!-- 第三种 table不行: -->
  35. <div>
  36. <input class="checkbox" type="checkbox" id="checkbox" />
  37. <table>
  38. 记住我(table不行,label可以)
  39. </table>
  40. </div>
  41. <!-- 第四种 第一个div行,第二个div不行: -->
  42. <div>
  43. <input class="checkbox_4" type="checkbox" id="checkbox" />
  44. <div>记住我(第一个可以)</div>
  45. <div>记住我(第二个不可以)</div>
  46. </div>
  47. <button>提交</button>
  48. </fieldset>
  49. <!-- 案例 -->
  50. <fieldset>
  51. <legend>电商策划</legend>
  52. <label class="cou" for="3">案例调查</label>
  53. <input type="checkbox" name="" id="3" class="anli">
  54. <ul>
  55. <li>网站开发1</li>
  56. <li>网站开发2</li>
  57. <li>网站开发3</li>
  58. <li>网站开发4</li>
  59. </ul>
  60. </fieldset>
  61. </form>
  62. </body>
  63. </html>

1.1 相关css

  1. fieldset :focus {
  2. background-color: rgb(236, 243, 236);
  3. transition: 0.4s;
  4. /* outline: none; */
  5. border: rgb(207, 54, 54) solid thin;
  6. }
  7. .checkbox:checked + label {
  8. color: red;
  9. }
  10. /* input[type="checkbox"]:checked + lable {
  11. color: red;
  12. } */
  13. /* 第二种 */
  14. .checkbox_2 {
  15. float: right;
  16. }
  17. .div2 .input:checked {
  18. color: red;
  19. /* float: left; */
  20. /* float: right; */
  21. }
  22. /* 第三种 */
  23. .checkbox:checked + table {
  24. color: red;
  25. }
  26. /* 第四种 */
  27. .checkbox_4:checked + div {
  28. color: red;
  29. }
  30. /* 案例 */
  31. .anli {
  32. display: none;
  33. /* cursor: pointer; */
  34. }
  35. .anli,
  36. ul {
  37. display: none;
  38. }
  39. .anli:checked + ul {
  40. display: block;
  41. }
  42. .cou {
  43. cursor: pointer;
  44. }

1.1.1 效果图:

" class="reference-link">效果图,lebel+input

2. 实例演示盒模型的五个核心属性,并描述padding,margin的简记规则

  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. <div class="box"></div>
  11. <style>
  12. .box {
  13. /* 鼠标检查移动过去查看页面宽高时,不计算margin,最多计算到border */
  14. width: 150px;
  15. height: 100px;
  16. background-color: aqua;
  17. /* 实线 */
  18. /* border: 10px solid red; */
  19. /* 虚线 dashed */
  20. border: 5px dashed red;
  21. background-clip: content-box;
  22. padding: 25px;
  23. margin: 20px;
  24. /* 设置盒子尺寸大小计算方式 */
  25. /* 推荐用以下这,把border计算在内 */
  26. /* box-sizing: border-box; */
  27. /* 这是计算盒子外边,类似于默认 */
  28. box-sizing: content-box;
  29. /* 将内容宽度width/高度height进行缩放,
  30. 来实现源码中的width/height与页面中的盒子大小计算完全一致 */
  31. /* 边框是可视属性,除了宽高,还可以设置样式 */
  32. /* 规则顺序:上下左右,顺时针 */
  33. /* 四值:padding: 10px 30px 20px 32px; 上下左右*/
  34. /* 三值:padding: 30px 20px 32px; 上 左右 下*/
  35. /* 二值:padding: 30px 32px; 上下 左右*/
  36. /* 一值:padding: 30px;上下左右全相等*/
  37. /* margin 和 padding 规则一样 */
  38. }
  39. /* 还有就是css重置reset
  40. 不用批量去写标签了,统一'*', */
  41. * {
  42. /* 外边距清零 */
  43. margin: 0;
  44. /* 内边距清零 */
  45. padding: 0;
  46. /* 盒子计算方式清零 */
  47. box-sizing: border-box;
  48. }
  49. </style>
  50. </body>
  51. </html>

总结

记住input+label的时候,前后位置不要换,input在label前面,checked:选中input的时候,后面元素跟着前面变

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!