Blogger Information
Blog 9
fans 0
comment 0
visits 4011
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
表单登陆实例、简单后台模拟及元素样式优先级演示
Original
313 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>Document</title>
  8. </head>
  9. <body>
  10. <form action="">
  11. <div>
  12. <label for="username">用户名:</label>
  13. <input type="text" name="username" id="username">
  14. </div>
  15. <div>
  16. <label for="psw">密码:</label>
  17. <input type="password" name="psw" id="psw">
  18. </div>
  19. <div>
  20. <label for="mymail">邮箱:</label>
  21. <input type="email" name="mymail" id="mymail">
  22. </div>
  23. <div>
  24. <button>登陆</button>
  25. </div>
  26. </form>
  27. </body>
  28. </html>

实例图:

简单后台架构代码及实例

  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>Document</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. <div class="header">
  43. <h1>管理后台</h1>
  44. <div>
  45. <span>admin</span>
  46. <a href="">退出</a>
  47. </div>
  48. </div>
  49. <ul class="nav">
  50. <li><a href="demo1.html" target="content">菜单选项1</a></li>
  51. <li><a href="demo2.html" target="content">菜单选项2</a></li>
  52. <li><a href="demo3.html" target="content">菜单选项3</a></li>
  53. <li><a href="demo4.html" target="content">菜单选项4</a></li>
  54. <li><a href="demo5.html" target="content">菜单选项5</a></li>
  55. </ul>
  56. <iframe srcdoc="<h3>此处显示菜单选项" frameborder="2" name="content"></iframe>
  57. </body>
  58. </html>

实例图:

元素样式来源及演示

元素属性继承

  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>Document</title>
  8. <style>
  9. body {
  10. color: red;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <h1>hello</h1>
  16. </body>
  17. </html>

实例图片

元素属性优先级 自定义样式优先级大于外部样式

  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>Document</title>
  8. <style>
  9. body {
  10. color: red;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <h1 style="color: blue;">hello</h1>
  16. </body>
  17. </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