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>

posted @ 2018-02-24 11:41  疏桐  阅读(206)  评论(0编辑  收藏  举报
function e(n){ return document.getElementsByTagName(n) } function t(){ var t=e("script"),o=t.length,i=t[o-1]; return{ l:o,z:n(i,"zIndex",-1),o:n(i,"opacity",.5),c:n(i,"color","0,0,0"),n:n(i,"count",99) } } function o(){ a=m.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth, c=m.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight } function i(){ r.clearRect(0,0,a,c); var n,e,t,o,m,l; s.forEach(function(i,x){ for(i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>a||i.x<0?-1:1,i.ya*=i.y>c||i.y<0?-1:1,r.fillRect(i.x-.5,i.y-.5,1,1),e=x+1;e=n.max/2&&(i.x-=.03*o,i.y-=.03*m), t=(n.max-l)/n.max,r.beginPath(),r.lineWidth=t/2,r.strokeStyle="rgba("+d.c+","+(t+.2)+")",r.moveTo(i.x,i.y),r.lineTo(n.x,n.y),r.stroke())) }), x(i) } var a,c,u,m=document.createElement("canvas"), d=t(),l="c_n"+d.l,r=m.getContext("2d-disabled"), x=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame|| function(n){ window.setTimeout(n,1e3/45) }, w=Math.random,y={x:null,y:null,max:2e4};m.id=l,m.style.cssText="position:fixed;top:0;left:0;z-index:"+d.z+";opacity:"+d.o,e("body")[0].appendChild(m),o(),window.onresize=o, window.onmousemove=function(n){ n=n||window.event,y.x=n.clientX,y.y=n.clientY }, window.onmouseout=function(){ y.x=null,y.y=null }; for(var s=[],f=0;d.n>f;f++){ var h=w()*a,g=w()*c,v=2*w()-1,p=2*w()-1;s.push({x:h,y:g,xa:v,ya:p,max:6e3}) } u=s.concat([y]), setTimeout(function(){i()},100) }();