博客列表 >登录表单, + ,元素样式来源与优先级

登录表单, + ,元素样式来源与优先级

愿情的博客
愿情的博客原创
2022年03月21日 18:25:17432浏览

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>表单</title>
  8. </head>
  9. <body>
  10. <!-- method: 提交类型,提交数据以?k=y&k=y查询字符串添加到url中 -->
  11. <!-- 1 get提交 -->
  12. <form action="" method="post">
  13. <div>
  14. <!-- type, name, value -->
  15. <label for="username">用户名:</label>
  16. <!-- label.for = input.id -->
  17. <!-- autofocus: 布尔属性 -->
  18. <input type="text" id="username" name="username" value="" placeholder="至少8位" autofocus required >
  19. </div>
  20. <div>
  21. <label for="psw">密码:</label>
  22. <input type="password" id="psw" name="password" value="" placeholder="字母+数字" required >
  23. </div>
  24. <div>
  25. <label for="my-email">邮箱:</label>
  26. <input type="email" id="my-email" name="email" value="" placeholder="字母+数字" required >
  27. <!-- !单选按钮 -->
  28. </div>
  29. <label for="male">性别:</label>
  30. <!-- 所有input,name必须相同 -->
  31. <input type="radio" name="gender" id="male" checked> <label for="male"></label>
  32. <input type="radio" name="gender" id="female"> <label for="female"></label>
  33. <div>
  34. <!-- !复选框 -->
  35. </div>
  36. <label for="">爱好:</label>
  37. <!-- 所有input,name必须相同 -->
  38. <input type="checkbox" name="hobbies" id="game" checked> <label for="game">游戏</label>
  39. <input type="checkbox" name="hobbies" id="programmer" checked> <label for="placeholder">编程</label>
  40. <input type="checkbox" name="hobbies" id="shoot"> <label for="shoot">摄影</label>
  41. </div>
  42. <div>
  43. <!-- !下拉列表 -->
  44. <!-- select.name, option.value , name,value属性不在同一个标签中 -->
  45. <label for="user">会员:</label>
  46. <select name="user" id="user">
  47. <option value="1" >铜牌会员</option>
  48. <option value="2">银牌会员</option>
  49. <option value="3" selected>金牌会员</option>
  50. </select>
  51. </div>
  52. <div>
  53. <!-- !多行文本框 -->
  54. <textarea name="" id="" cols="30" rows="10"></textarea>
  55. </div>
  56. <div>
  57. <button>提交</button>
  58. </div>
  59. </form>
  60. </body>
  61. </html>

2 <a> + <iframe>

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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>iframe小后台</title>
  8. <style>
  9. body {
  10. height: 100vh;
  11. width: 100vw;
  12. display: grid;
  13. grid-template-columns: 10em 1fr;
  14. grid-template-rows: 6em 1fr;
  15. margin: 0;
  16. }
  17. body .header {
  18. grid-column-end: span 2;
  19. border-bottom: 1px solid currentColor;
  20. background-color: #efe;
  21. padding: 2em;
  22. display: flex;
  23. align-items: center;
  24. }
  25. body .header div {
  26. margin-left: auto;
  27. }
  28. body .nav {
  29. background-color: #efc;
  30. margin: 0;
  31. padding-top: 1em;
  32. list-style: none;
  33. }
  34. body iframe {
  35. width: calc(100vw - 10em);
  36. height: calc(100vh - 6em);
  37. border-left: 1px solid currentColor;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <!-- 后台顶部 -->
  43. <div class="header">
  44. <h1>管理后台</h1>
  45. <div>
  46. <span>admin</span>
  47. <a href="">退出</a>
  48. </div>
  49. </div>
  50. <!-- 左侧导航 -->
  51. <ul class="nav">
  52. <li><a href="demo1.html" target="content">菜单项1</a></li>
  53. <li><a href="demo2.html" target="content">菜单项2</a></li>
  54. <li><a href="demo1.html" target="content">菜单项3</a></li>
  55. <li><a href="demo2.html" target="content">菜单项4</a></li>
  56. <li><a href="demo1.html" target="content">菜单项5</a></li>
  57. </ul>
  58. <!-- 右侧内容区 -->
  59. <iframe src="" frameborder="2" name="content"></iframe>
  60. </body>
  61. </html>

3:元素样式来源与优先级

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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="static/style.css" /> -->
  9. <style>
  10. @import url('static/style.css');
  11. </style>
  12. </head>
  13. <body>
  14. <!-- 1. 默认样式: 继承自html -->
  15. <!-- 2. 自定义样式1: 行内样式, style属性 -->
  16. <!-- <h1 style="color: blue">晚上好</h1>
  17. <h1 style="color: blue">吃了吗?</h1> -->
  18. <!-- 3. 自定义样式2: 文档样式/内部样式, style标签 -->
  19. <h1>晚上好</h1>
  20. <h1>吃了吗?</h1>
  21. <h1>xxx</h1>
  22. <!-- <style>
  23. /* 分二步:
  24. 1. 找到它: 选择器
  25. 2. 设置它: 样式声明 */
  26. h1 {
  27. color: blue;
  28. }
  29. </style> -->
  30. <!-- 4. 自定义样式3: 外部样式, css文档 -->
  31. </body>
  32. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议