Blogger Information
Blog 12
fans 0
comment 0
visits 5771
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1019作业
PHP是世界上最好的语言
Original
561 people have browsed it

作业内容:

  1. <iframe>写一个后台小案例: <a>+<iframe>实现
  2. 实例演示 标签,属性选择器, 以及群组选择器的使用场景

后台小案例

代码

index.html

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>php中文网后台管理系统</title>
  6. <link rel="stylesheet" href="./css/admin.css"/>
  7. </head>
  8. <body>
  9. <div class="content">
  10. <div class="left">
  11. <div class="logo">
  12. <h3>php.cn 后台管理系统</h3>
  13. </div>
  14. <div class="menu">
  15. <nav>
  16. <a href="home.html" target="content">首页</a>
  17. <a href="courses.html" target="content">课程管理</a>
  18. <a href="teachers.html" target="content">教师管理</a>
  19. <a href="orders.html" target="content">订单管理</a>
  20. </nav>
  21. </div>
  22. </div>
  23. <div class="right">
  24. <header>
  25. <section>
  26. <em>admin</em>
  27. <button onclick="location.href='logout.php'">退出</button>
  28. </section>
  29. </header>
  30. <iframe src="home.html" name="content"></iframe>
  31. </div>
  32. </div>
  33. </body>
  34. </html>

home.html

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <h1>首页</h1>
  9. </body>
  10. </html>

courses.html

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <h1>课程管理</h1>
  9. </body>
  10. </html>

orders.html

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <h1>订单管理</h1>
  9. </body>
  10. </html>

admin.css

  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. a {
  7. text-decoration: none;
  8. color: #555;
  9. }
  10. .content {
  11. height: 100vh;
  12. width: 100vw;
  13. display: grid;
  14. grid-template-columns: 12em 1fr;
  15. grid-template-areas:
  16. "left right";
  17. }
  18. .left {
  19. grid-area: left;
  20. background-color: gray;
  21. }
  22. .right {
  23. grid-area: right;
  24. }
  25. .logo {
  26. color: whitesmoke;
  27. background-color: seagreen;
  28. height: 5.5em;
  29. text-align: center;
  30. padding-top: 30px;
  31. }
  32. body header {
  33. background-color: white;
  34. letter-spacing: 2px;
  35. padding: 2em;
  36. display: flex;
  37. place-items: center;
  38. border-bottom: #eee;
  39. }
  40. body header h1 {
  41. color: grey;
  42. font-weight: 500;
  43. text-shadow: 1px 1px 1px #000;
  44. }
  45. body header section {
  46. margin-left: auto;
  47. padding-right: 2em;
  48. }
  49. body header section em {
  50. color: grey;
  51. margin-right: 1em;
  52. }
  53. body header section button {
  54. padding: 3px 10px;
  55. border: none;
  56. outline: none;
  57. transition: 0.3s;
  58. }
  59. body header section button:hover {
  60. background-color: coral;
  61. color: #fff;
  62. cursor: pointer;
  63. }
  64. nav {
  65. display: grid;
  66. grid-auto-rows: min-content;
  67. border-right: 1px solid currentColor;
  68. background-color: gray;
  69. padding: 1em;
  70. list-style: none;
  71. }
  72. nav a {
  73. padding: 0.5em 0;
  74. border-bottom: 1px solid #555;
  75. color: #fff;
  76. }
  77. nav a:hover {
  78. transition: 0.3s;
  79. font-size: 1.01em;
  80. color: black;
  81. }
  82. body iframe {
  83. width: calc(100vw - 10em);
  84. height: calc(100vh - 6em);
  85. border: none;
  86. background-color: #efefef;
  87. }

效果

选择器的使用

html

  1. <div class="content">
  2. <div class="left">
  3. <div class="logo">
  4. <h3>php.cn 后台管理系统</h3>
  5. </div>
  6. <div class="menu">
  7. <nav>
  8. <a class="active" href="home.html" target="content">首页</a>
  9. <a href="courses.html" target="content">课程管理</a>
  10. <a href="teachers.html" target="content">教师管理</a>
  11. <a href="orders.html" target="content">订单管理</a>
  12. </nav>
  13. </div>
  14. </div>
  15. <table id="time-table">
  16. <caption><h2>课程表</h2></caption>
  17. <thead>
  18. <tr>
  19. <th colspan="2">节次\星期</th>
  20. <th>星期一</th>
  21. <th>星期二</th>
  22. <th>星期三</th>
  23. <th>星期四</th>
  24. <th>星期五</th>
  25. </tr>
  26. </thead>
  27. <tbody>
  28. <tr>
  29. <td colspan="7" style="background-color: lightgray;">
  30. <p style="margin: 2;">早自习</p>
  31. <p style="margin: 2;">07:00 - 07:50</p>
  32. </td>
  33. </tr>
  34. <tr>
  35. <th rowspan="4">上午</th>
  36. <th>
  37. <p>第一节</p>
  38. <p>08:00 - 08:40</p>
  39. </th>
  40. <td>语文</td>
  41. <td>数学</td>
  42. <td>英语</td>
  43. <td>化学</td>
  44. <td>物理</td>
  45. </tr>
  46. <tr>
  47. <th>
  48. <p>第二节</p>
  49. <p>08:50 - 09:30</p>
  50. </th>
  51. <td>语文</td>
  52. <td>数学</td>
  53. <td>英语</td>
  54. <td>化学</td>
  55. <td>物理</td>
  56. </tr>
  57. <tr>
  58. <th>
  59. <p>第三节</p>
  60. <p>09:40 - 10:20</p>
  61. </th>
  62. <td>语文</td>
  63. <td>数学</td>
  64. <td>英语</td>
  65. <td>化学</td>
  66. <td>物理</td>
  67. </tr>
  68. <tr>
  69. <th>
  70. <p>第四节</p>
  71. <p>10:30 - 11:20</p>
  72. </th>
  73. <td>语文</td>
  74. <td>数学</td>
  75. <td>英语</td>
  76. <td>化学</td>
  77. <td>物理</td>
  78. </tr>
  79. <tr>
  80. <td colspan="7" style="background-color: lightgray;">
  81. <p>午休</p>
  82. <p>12:00 - 14:00</p>
  83. </td>
  84. </tr>
  85. <tr>
  86. <th rowspan="3">上午</th>
  87. <th>
  88. <p>第五节</p>
  89. <p>14:00 - 14:40</p>
  90. </th>
  91. <td>语文</td>
  92. <td>数学</td>
  93. <td>英语</td>
  94. <td>化学</td>
  95. <td>物理</td>
  96. </tr>
  97. <tr>
  98. <th>
  99. <p>第六节</p>
  100. <p>14:50 - 15:30</p>
  101. </th>
  102. <td>语文</td>
  103. <td>数学</td>
  104. <td>英语</td>
  105. <td>化学</td>
  106. <td>物理</td>
  107. </tr>
  108. <tr>
  109. <th>
  110. <p>第七节</p>
  111. <p>15:40 - 16:40</p>
  112. </th>
  113. <td>语文</td>
  114. <td>数学</td>
  115. <td>英语</td>
  116. <td>化学</td>
  117. <td>物理</td>
  118. </tr>
  119. <td colspan="7" style="background-color: lightgray;">
  120. <p>晚自习</p>
  121. <p>19:00 - 21:50</p>
  122. </td>
  123. </tr>
  124. </tbody>
  125. <tfoot>
  126. <tr>
  127. <!-- 水平方向合并/列合并 : colspan -->
  128. <th colspan="2">课程表有效期:</th>
  129. <td colspan="5">2022年10月1日-2023年5月1日</td>
  130. </tr>
  131. </tfoot>
  132. </table>
  133. </div>

CSS代码

标签选择器

  1. h3 {
  2. color: red;
  3. }
  4. a {
  5. text-decoration: none;
  6. color: gray;
  7. }
  8. #time-table p {
  9. margin: 2px;
  10. }

属性选择器

  1. a.active {
  2. color: orange;
  3. }

群组选择器

  1. /* 群组选择器, 多个选择器之间用逗号分开 */
  2. #time-table, th, td{
  3. border: solid gray 2px;
  4. text-align: center;
  5. }
  6. /* 群组选择器, 多个选择器之间用逗号分开 */
  7. tfoot th, tfoot td {
  8. border: none;
  9. }

效果

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