HTML&javaSkcript&CSS&jQuery&ajax(三)
一、HTML块元素
1、块级元素 Block level element ,内联元素 inline element , HTML<div>元素属于块级元素,他是组合其他HTML元素的容器,当与CSS一同使用<div>元素用于对大内容块设置样式属性。<div>用于文档布局,
2、HTML <span> 元素是内联元素,用于文本的容器,设置<div>元素的类,能够为相同的<div>元素设置相同的类
<!DOCTYPE html>
<html>
<head>
<style>
.cities{
background-color:green;
color:black;
margin:20px;
padding:20px;
}
</style>
</head>
<body>
<div class="cities">
<h2>London</h2>
<p>London is the capital ciry of England.<br/>
It is the most populous city in the United Kingdom<br/>
with a metropolitan qrea of over 13 million inhabitants<br/>
</p>
</div>
</html>
3、分行内元素, HTML<span>元素是行内元素,能够作用域文本容器, 设置<span>元素的类,能够为相同的<span>隐患苏设置相同的样式。
<!DOCTYPE html >
<html><head><style> span.red{color:red;} </style></head><body>
<h1> my <span class="red">Important</span>Heading</h1>
4、使用<div>元素HTML布局,能够对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;
float:left;
padding:5px;
}
#nac{
line-height:30px;
background-color:#eeeeee;
height:300px;
float:right;
padding:10px;
}
#section{
width:350px;
float:left;
padding:10px;
}
#footer{
background-color:black;
color:white;
clear:both;
text-align:center;
padding:5px;}
</style>
<body>
<div id="header">
<h1>City Gallery</h1>
</div>
<div id="nav">
London<br>
Paris<br>
Tokoy<br>
</div>
<div id="nac">
亚明<br>
倩倩<br>
爱你<br>
</div>
<div id="section">
<h1>London</h1>
<p>
London is the capital city of England. it is the most populars city in the United
Kingdom, with a metropolitan area of over 13 million inhabitants.
</p></div>
<div id="footer">
Copyright W3cSchool.com.cn</div>
</body>
</html>
5、HTML表格定义
<table>元素作用是显示表格化的数据。
使用<table>元素能够取得布局效果,通过CSS设置表格元素的样式
<!DOCTYPE html>
<html>
<head>
<style>
table.lamp{
width:100%;
broder:1px solid #d4d4d4;}
table.lamp th td{
padding:10px;}
table.lamp td{
width:100px;
}
</style>
<body>
<table class="lamp">
<tr>
<th>
<img src="G:/MYXJ_20170721115944_save-01.jpeg" alt="Note"
style="height:200px;width:200px"></th>
<td> The table element was not designed to be layout tool</td></tr></table>
</body>
</html>