HTML元素之区块

分组标签

标签 描述
div 定义文档的区域,块级元素(block-level)
span 用来组合文档中的行内元素,内联元素(inline)

块级元素在浏览器显示时会自动添加折行

使用div进行布局的示例

<!DOCTYPE html>
<html>
<body>

<div id="container" style="width:800px">

<div id="header" style="background-color:#FFA500;">
<h1 style="margin-bottom:0;">Main Title of Web Page</h1></div>

<div id="menu" style="background-color:#FFD700;height:200px;width:100px;float:left;">
<b>Menu</b><br>
HTML<br>
CSS<br>
JavaScript</div>

<div id="content" style="background-color:#EEEEEE;height:200px;width:700px;float:left;">
Content goes here</div>

<div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">
Copyright © w3cschool.cn</div>

</div>
 
</body>
</html>
发布了25 篇原创文章 · 获赞 19 · 访问量 668

猜你喜欢

转载自blog.csdn.net/devin_xin/article/details/105011147