最近在学习了html5,学习了常见的两种布局:
html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>div布局title>
<style type="text/css">
body{
margin: 0px;
}
#container{
width: 100%;
height: 950px;
background: gray;
}
#heading{
width: 100%;
height: 10%;
background: red;
}
#context_menu{
width: 20%;
height: 80%;
background: greenyellow;
float: right;
}
#context_body{
width: 80%;
height: 80%;
background: chartreuse;
float: left;
}
#footing{
width: 100%;
height: 10%;
background: darkgreen;
}
style>
head>
<body>
<div id="container">
<div id="heading">头部div>
<div id="context_menu">内容菜单div>
<div id="context_body">内容主体div>
<div id="footing">底部div>
div>
body>
html>
table的布局:
html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>table布局title>
head>
<body marginwidth="0px" marginheight="0px">
<table width="100%" height="950px" style="background-color: gray">
<tr>
<td colspan="2" width="100%" height="10%" style="background-color: red">这是头部td>
tr>
<tr>
<td width="20%" height="80%" style="background-color: aqua">左菜单td>
<td width="80%" height="80%" style="background-color: darkgreen">td>
tr>
<tr>
<td width="100%" height="10%" style="background-color: darkred" colspan="2">这是底部td>
tr>
table>
body>
html>
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有