HTML5 1.7 div元素与布局
2016-03-09 20:51
399 查看
1.元素的分类
a.块元素,会产生换行效果,自动与其他元素分离成两行;通常可以作为容器在内部添加其他元素。
如:h1~h6,hr,ul,ol,p,table
b.内部元素,不会产生换行效果
如:b,i,br,img
2.div元素与布局
a.div是通用的块元素,内部可以包含其他元素包括其他div元素。并且可以通过css设置样式
[b]A[/b]
<!DOCTYPE html>
< html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>例7</title>
</head>
<body>
<div style=“width:100%;height:708px;”>
<div style=”background:green;width:100%;height:10%“>我是标题</div>
<div style=”background:blue;width:20%;height:80%; float=left;>我是导航栏</div>
<div style=”background:red;width:80%;height:80%; float=left;>我是内联框架</div>
<div style=”background:yellow;width:100%;height:10%; float=left;>我是尾部</div>
</div>
</body>
</html>
[b]B
[/b]
<!DOCTYPE html>
< html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>例7</title>
<style type=”text/css“>
#div1{style=“width:100%;height:708px;”}
#div1{style=”background:green;width:100%;height:10%“}
#div1{style=”background:blue;width:20%;height:80%; float=left;“}
#div1{style=”background:red;width:80%;height:80%; float=left;“}
#div1{style=”background:yellow;width:100%;height:10%; float=left;}
</style>
</head>
<body>
<div id=”div1”>
<div id=”div2“>我是标题</div>
<div id=”div3“>我是导航栏</div>
<div id=”div4“>我是内联框架</div>
<div id=”“div5“>我是尾部</div>
</div>
</body>
</html>
[b]c
[/b]
<!DOCTYPE html>
< html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>例7</title>
<style type=”text/css“>
.class1{background:red}
#div1{style=“width:100%;height:708px;”}
#div1{style=”background:green;width:100%;height:10%“}
#div1{style=”background:blue;width:20%;height:80%; float=left;“}
#div1{style=”background:red;width:80%;height:80%; float=left;“}
#div1{style=”background:yellow;width:100%;height:10%; float=left;}
</style>
</head>
<body>
<div id=”div1”>
<div id=”div2“>我是标题</div>
<div id=”div3“>我是导航栏</div>
<div id=”div4“>我是内联框架</div>
<div id=”“div5“>我是尾部</div>
</div>
<b title="我可以加粗文字">我是b标签</b>
<bdo dir="rtl">文字走向</bdo>
<p dir="rtl">我是段落1234567889</p>
</body>
</html>
a.块元素,会产生换行效果,自动与其他元素分离成两行;通常可以作为容器在内部添加其他元素。
如:h1~h6,hr,ul,ol,p,table
b.内部元素,不会产生换行效果
如:b,i,br,img
2.div元素与布局
a.div是通用的块元素,内部可以包含其他元素包括其他div元素。并且可以通过css设置样式
[b]A[/b]
<!DOCTYPE html>
< html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>例7</title>
</head>
<body>
<div style=“width:100%;height:708px;”>
<div style=”background:green;width:100%;height:10%“>我是标题</div>
<div style=”background:blue;width:20%;height:80%; float=left;>我是导航栏</div>
<div style=”background:red;width:80%;height:80%; float=left;>我是内联框架</div>
<div style=”background:yellow;width:100%;height:10%; float=left;>我是尾部</div>
</div>
</body>
</html>
[b]B
[/b]
<!DOCTYPE html>
< html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>例7</title>
<style type=”text/css“>
#div1{style=“width:100%;height:708px;”}
#div1{style=”background:green;width:100%;height:10%“}
#div1{style=”background:blue;width:20%;height:80%; float=left;“}
#div1{style=”background:red;width:80%;height:80%; float=left;“}
#div1{style=”background:yellow;width:100%;height:10%; float=left;}
</style>
</head>
<body>
<div id=”div1”>
<div id=”div2“>我是标题</div>
<div id=”div3“>我是导航栏</div>
<div id=”div4“>我是内联框架</div>
<div id=”“div5“>我是尾部</div>
</div>
</body>
</html>
[b]c
[/b]
<!DOCTYPE html>
< html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>例7</title>
<style type=”text/css“>
.class1{background:red}
#div1{style=“width:100%;height:708px;”}
#div1{style=”background:green;width:100%;height:10%“}
#div1{style=”background:blue;width:20%;height:80%; float=left;“}
#div1{style=”background:red;width:80%;height:80%; float=left;“}
#div1{style=”background:yellow;width:100%;height:10%; float=left;}
</style>
</head>
<body>
<div id=”div1”>
<div id=”div2“>我是标题</div>
<div id=”div3“>我是导航栏</div>
<div id=”div4“>我是内联框架</div>
<div id=”“div5“>我是尾部</div>
</div>
<b title="我可以加粗文字">我是b标签</b>
<bdo dir="rtl">文字走向</bdo>
<p dir="rtl">我是段落1234567889</p>
</body>
</html>
相关文章推荐
- HTML5 1.6 table布局
- HTML5初探
- Web前端学习笔记(3)-html5新增表单元素
- html5 式程序员表白
- html5 页面嵌入视频
- Web前端学习笔记(2)-html5新增的结构元素
- 【html5】Web Storage本地存储 sessionStorage/localStorage
- 读书笔记---HTML5实战 MARCO CASARIO(后六章)
- html5 canvas画进度条
- 读书笔记---HTML5实战 MARCO CASARIO(前六章)
- HTML5学习之-Canvas
- HTML5 canvas绘制雪花飘落动画(需求分析、知识点、程序编写分布详解)
- HTML5提供的一些新的标签用法以及和HTML 4的区别
- H5+百度接口定位
- 移动前端头部标签(HTML5 head meta)
- 初学HTML5、初入前端
- 初学HTML5、初入前端
- ie8如何支持html5
- HTML5 canvas绘制雪花飘落动画(需求分析、知识点、程序编写分布详解)
- html5