Blogger Information
Blog 9
fans 0
comment 0
visits 3526
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1021——状态伪类和盒模型
手机用户284061708
Original
383 people have browsed it

1 举例说明状态伪类

  1. <style>
  2. form{
  3. margin-left: 36%;
  4. }
  5. fieldset{
  6. width: fit-content;
  7. background:
  8. radial-gradient(circle at 50% 0,
  9. rgba(255,0,0,.5),
  10. rgba(255,0,0,0) 70.71%),
  11. radial-gradient(circle at 6.7% 75%,
  12. rgba(0,0,255,.5),
  13. rgba(0,0,255,0) 70.71%);
  14. }
  15. div{
  16. margin: 10px;
  17. }
  18. div span{
  19. color: red;
  20. }
  21. .tijiao{
  22. text-align: center;
  23. }
  • 必填

  1. /* 必填 */
  2. input:required {
  3. border: 1px solid black;
  4. }

效果如下:
必填

  • 被选中

  1. /* 被选中 */
  2. input:focus {
  3. border: 1px solid silver;
  4. }

选中

  • 悬停

  1. /* 鼠标在按钮时悬停切换成手势图标,字体变粗,颜色变成棕色 */
  2. div button:hover{
  3. color: brown;
  4. font-weight: bolder;
  5. cursor:pointer;
  6. }
  7. </style>

悬停

  1. <form accept="register.php" method="post">
  2. <fieldset>
  3. <legend>用户注册</legend>
  4. <!-- 用户名 -->
  5. <div>
  6. <label for="username">用&nbsp;&nbsp;户&nbsp;&nbsp;名: </label>
  7. <input id="username" name="username" type="text" required />
  8. <span >*</span>
  9. </div>
  10. <!-- 密码 -->
  11. <div>
  12. <label for="password">密 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 码: </label>
  13. <input id="password" name="password" type="text" required />
  14. <span >*</span>
  15. </div>
  16. <!-- 确认密码 -->
  17. <div>
  18. <label for="repwd">确认密码: </label>
  19. <input id="repwd" name="repwd" type="text" required />
  20. <span >*</span>
  21. </div>
  22. <div>
  23. <label for="email">
  24. 用户邮箱:
  25. </label>
  26. <input id="email" name="email" type="email" />
  27. <span >*</span>
  28. </div>
  29. <div class="tijiao">
  30. <button>注册</button>
  31. <button>取消</button>
  32. </div>
  33. </fieldset>
  34. </form>

盒模型

2.1 盒模型的五个核心属性:

  • width —- 宽度
  • height —- 高度
  • border —- 边框
  • margin —- 外边距
  • padding —-内边距
  1. <style>
  2. .box{
  3. width: 200px;
  4. height: 120px;
  5. margin: 30px;
  6. padding: 30px;
  7. border: 5px solid rgb(152, 46, 46);
  8. }
  9. </style>
  10. <div class="box"></div>

属性指示如下:
盒模型

2.2 padding margin 简记规则

1 盒子的顺时针方向;

4值语法:上,右,下,左
3值语法:上,左右,下
2值语法:上下,左右
1值语法:上下左右相等

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