html5怎么分格局,三层

html-css07

html5怎么分格局,三层,第1张

可以通过DIV来分块布局,然后通过CSS样式来调整大小,颜色等样式。参考代码如下:

<!DOCTYPE html>

<html>

<head>

<style>

#header {

background-color:black

color:white

text-align:center

padding:5px

}

#nav {

line-height:30px

background-color:#eeeeee

height:300px

width:100px

float:left

padding:5px

}

#section {

width:350px

float:left

padding:10px

}

#footer {

background-color:black

color:white

clear:both

text-align:center

padding:5px

}

</style>

</head>

<body>

<div id="header">

<h1>第一层</h1>

</div>

<div id="nav">

第二层左侧

</div>

<div id="section">

第二层右侧

</div>

<div id="footer">

第三层

</div>

</body>

</html>

标准格式如下:

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=UTF-8" />

<title>Your Website</title>

</head>

<body>

<header>

<nav>

<ul>

<li>Your menu</li>

</ul>

</nav>

</header>

<section>

<article>

<header>

<h2>Article title</h2>

<p>Posted on <time datetime="2009-09-04T16:31:24+02:00">September 4th 2009</time>by <a href="#">Writer</a>- <a href="#comments">6 comments</a></p>

</header>

<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>

</article>

<article>

<header>

<h2>Article title</h2>

<p>Posted on <time datetime="2009-09-04T16:31:24+02:00">September 4th 2009</time>by <a href="#">Writer</a>- <a href="#comments">6 comments</a></p>

</header>

<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>

</article>

</section>

<aside>

<h2>About section</h2>

<p>Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>

</aside>

<footer>

<p>Copyright 2009 Your name</p>

</footer>

</body>

</html>