html5新增了几个布局标签,下面我们将新增的标签分析一下。
1.<header>设置页面的头部页眉
2.<footer>设置页面的页脚
3.<main>设置页面的主体,每个页面仅限一个
4.<article>标识文档
5.<aside>标识边栏
6.<nav>标识导航
7.<section>区块
8.<div>自定义区块,可放javascript或其它
(二) 2.1以下是文档管理的布局代码
实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>文档管理</title> </head> <body> <table> <caption>文档管理</caption> <tr> <td>ID</td> <td>文档名</td> <td>文档类型</td> <td>文档大小</td> <td>操作</td> </tr> <tr> <td>1</td> <td>工作日志1</td> <td>日志</td> <td>200kb</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> <tr> <td>2</td> <td>php.xls</td> <td>电子表格</td> <td>1024kb</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> </table> <!--分页--> <p> <a href="">首页</a> <a href="" class="active">1</a> <a href="">2</a> <a href="">3</a> <a href="">4</a> <a href="" class="more">...</a> <a href="">尾页</a> </p> </body> </html> <style> table, th, td { border: 1px solid black; } table { width: 650px; margin: auto; border-collapse: collapse; text-align: center; } td { padding: 10px; } a { text-decoration-line: none; color: green; } a:hover { color: brown; text-decoration-line: underline; } tr:first-child { margin-top: 20px; background-color: lightblue; } table caption { font-size: 1.5rem; font-weight: bolder; margin-bottom: 20px; } p { text-align: center; } /*首页样式*/ p a:first-child { width: 56px; } p a:last-child { width: 56px; } p a { display: inline-block; width: 28px; height: 24px; border: 1px solid green; margin-left:2px; line-height: 24px; } /*当前页样式*/ .active { background-color: green; color: white; } .more { border: none; } </style>
运行实例 »
点击 "运行实例" 按钮查看在线实例
实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>文档管理</title> </head> <body> <table> <caption>文档管理</caption> <tr> <td>ID</td> <td>文档名</td> <td>文档类型</td> <td>文档大小</td> <td>操作</td> </tr> <tr> <td>1</td> <td>工作日志1</td> <td>日志</td> <td>200kb</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> <tr> <td>2</td> <td>php.xls</td> <td>电子表格</td> <td>1024kb</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> </table> <!--分页--> <p> <a href="">首页</a> <a href="" class="active">1</a> <a href="">2</a> <a href="">3</a> <a href="">4</a> <a href="" class="more">...</a> <a href="">尾页</a> </p> </body> </html> <style> table, th, td { border: 1px solid black; } table { width: 650px; margin: auto; border-collapse: collapse; text-align: center; } td { padding: 10px; } a { text-decoration-line: none; color: green; } a:hover { color: brown; text-decoration-line: underline; } tr:first-child { margin-top: 20px; background-color: lightblue; } table caption { font-size: 1.5rem; font-weight: bolder; margin-bottom: 20px; } p { text-align: center; } /*首页样式*/ p a:first-child { width: 56px; } p a:last-child { width: 56px; } p a { display: inline-block; width: 28px; height: 24px; border: 1px solid green; margin-left:2px; line-height: 24px; } /*当前页样式*/ .active { background-color: green; color: white; } .more { border: none; } </style>
运行实例 »
点击 "运行实例" 按钮查看在线实例
2.2 类别管理的界面如下
实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>类别管理</title> </head> <body> <table> <caption>类别管理</caption> <tr> <td>ID</td> <td>类别名</td> <td>操作</td> </tr> <tr> <td>1</td> <td>日志</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> <tr> <td>2</td> <td>电子表格</td> <td>1024kb</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> </table> <!--分页--> <p> <a href="">首页</a> <a href="" class="active">1</a> <a href="">2</a> <a href="">3</a> <a href="">4</a> <a href="" class="more">...</a> <a href="">尾页</a> </p> </body> </html> <style> table, th, td { border: 1px solid black; } table { width: 650px; margin: auto; border-collapse: collapse; text-align: center; } td { padding: 10px; } a { text-decoration-line: none; color: green; } a:hover { color: brown; text-decoration-line: underline; } tr:first-child { margin-top: 20px; background-color: lightblue; } table caption { font-size: 1.5rem; font-weight: bolder; margin-bottom: 20px; } p { text-align: center; } /*首页样式*/ p a:first-child { width: 56px; } p a:last-child { width: 56px; } p a { display: inline-block; width: 28px; height: 24px; border: 1px solid green; margin-left:2px; line-height: 24px; } /*当前页样式*/ .active { background-color: green; color: white; } .more { border: none; } </style>
运行实例 »
点击 "运行实例" 按钮查看在线实例
3、 产品管理页面
实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>产品管理</title> </head> <body> <table> <caption>产品管理</caption> <tr> <td>ID</td> <td>图片</td> <td>型号</td> <td>价格</td> <td>操作</td> </tr> <tr> <td>1</td> <td><img src="./static/images/1.jpg" alt="" width="50"></td> <td>iPhone X</td> <td>5888</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> <tr> <td>2</td> <td><img src="./static/images/2.jpg" alt="" width="50"></td> <td>华为 P20</td> <td>7888</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> <tr> <td>3</td> <td><img src="./static/images/3.jpg" alt="" width="50"></td> <td>小米 9</td> <td>6899</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> <tr> <td>4</td> <td><img src="./static/images/4.jpg" alt="" width="50"></td> <td>OPPO X1</td> <td>3999</td> <td><a href="">编辑</a> | <a href="">删除</a></td> </tr> </table> <!--分页--> <p> <a href="">首页</a> <a href="" class="active">1</a> <a href="">2</a> <a href="">3</a> <a href="">4</a> <a href="" class="more">...</a> <a href="">尾页</a> </p> </body> </html> <style> table, th, td { border: 1px solid black; } table { width: 650px; margin: auto; border-collapse: collapse; text-align: center; } td { padding: 10px; } a { text-decoration-line: none; color: green; } a:hover { color: brown; text-decoration-line: underline; } tr:first-child { margin-top: 20px; background-color: lightblue; } table caption { font-size: 1.5rem; font-weight: bolder; margin-bottom: 20px; } p { text-align: center; } /*首页样式*/ p a:first-child { width: 56px; } p a:last-child { width: 56px; } p a { display: inline-block; width: 28px; height: 24px; border: 1px solid green; margin-left:2px; line-height: 24px; } /*当前页样式*/ .active { background-color: green; color: white; } .more { border: none; } </style>
运行实例 »
点击 "运行实例" 按钮查看在线实例
总结:通过学习HTML新的标签,总体页面的布局趋于更加简单,同时页面划分更加清晰。通过以上的几个管理的页面,有助于更好理解这些标签。