博客列表 >登录表单与简易框架与css元素理解

登录表单与简易框架与css元素理解

新手1314
新手1314原创
2022年03月20日 17:35:13546浏览

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. <form action="login.php" method="post">
  11. <div>
  12. <label for="user">用户名:</label>
  13. <input type="text" name="user" id="user" placeholder="请输入用户名" required autofocus>
  14. </div>
  15. <div>
  16. <label for="password"> 密码:</label>
  17. <input type="password" name="password" id="password" placeholder="请输入密码" required>
  18. </div>
  19. <div>
  20. <label for="email"> 邮箱:</label>
  21. <input type="email" name="email" id="email" placeholder="请输入正确格式的邮箱" required>
  22. </div>
  23. <div>
  24. <label for="man">性别:</label>
  25. <input type="radio" name="sex" id="man" checked><label for="man"></label>
  26. <input type="radio" name="sex" id="girl"><label for="girl"></label>
  27. </div>
  28. <div>
  29. <label for="game">爱好:</label>
  30. <input type="checkbox" name="hobby[]" id="game"><label for="game">游戏</label>
  31. <input type="checkbox" name="hobby[]" id="film"><label for="film">看电影</label>
  32. <input type="checkbox" name="hobby[]" id="biancheng"><label for="biancheng">编程</label>
  33. </div>
  34. <label for="">地区:</label>
  35. <select name="diqu" id="diqu">
  36. <option value="1">福建</option>
  37. <option value="2" selected>上海</option>
  38. <option value="3">北京</option>
  39. <option value="4">武汉</option>
  40. </select>
  41. <div>
  42. <button>登录</button>
  43. </div>
  44. </form>
  45. </body>
  46. </html>

实现:

2.简易框架

代码:

  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. <style>
  9. body{
  10. display: grid;
  11. grid-template-columns: 10em 1fr;
  12. grid-template-rows: 6em 1fr;
  13. margin: 0;
  14. }
  15. body .head{
  16. grid-column-end: span 2;
  17. border-bottom: 2px solid currentColor;
  18. background-color: bisque;
  19. display: flex;
  20. align-items: center;
  21. padding: 2em;
  22. }
  23. body .head div{
  24. margin-left: auto;
  25. }
  26. .new{
  27. list-style: none;
  28. background-color: aquamarine;
  29. margin: 0;
  30. padding: 30px;
  31. height: 480%;
  32. }
  33. iframe{
  34. width: 100%;
  35. height: 500%;
  36. border-left: 1px solid currentColor;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <div class="head">
  42. <h2>后台管理系统</h2>
  43. <div>
  44. <p>管理员账号:admin</p>
  45. <a href="">退出</a>
  46. </div>
  47. </div>
  48. <ul class="new">
  49. <li><a href="demo1.html" target="user">菜单项1</a></li>
  50. <li><a href="demo2.html" target="user">菜单项2</a></li>
  51. <li><a href="zuoye2.html" target="user">菜单项3</a></li>
  52. <li><a href="demo4.html" target="user">菜单项4</a></li>
  53. <li><a href="demo5.html" target="user">菜单项5</a></li>
  54. </ul>
  55. <iframe src="" name="user"></iframe>
  56. </body>
  57. </html>

实现:

3.css元素理解

1.css元素来源:

  1. 内部样式:
    1. 自定义样式:使用`<a style color="red"></a>`来设置当前`<a>标签`元素属性。
    2. 默认样式:使用<h1></h1>标签来默认样式
  2. 外部样式:
    1. `<link rel="stylesheet" href="style.css">`来导入外部样式表。

    内部样式代码:

    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>css样式演示</title>
    8. <style>
    9. .ys{
    10. color: aquamarine;
    11. }
    12. </style>
    13. </head>
    14. <body>
    15. <span>内部样式表</span>
    16. <h1 style="color: bisque;">演示:Hello World</h1>
    17. <h1>Hello</h1>
    18. </body>
    19. </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>css样式演示</title>
  8. <link rel="stylesheet" href="static/styles.css">
  9. </head>
  10. <body>
  11. <h1 class="wb">World</h1>
  12. </body>
  13. </html>

实现:

2.css样式优先级

(优先级相同的情况下)书写顺序后的属性会覆盖前面属性。

实例:

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议