01 复习内容

复习之前的知识点

02演示VS创建元素

03div和span区别

通过display属性进行DIV与Span之间的转换。div->span 设置display:inline    span->div 设置display:block

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<div style="border:red solid 1px;height:200px;">
<input type="button" name="name" value="我是按钮,我骄傲"/>
</div>
<span>
我也骄傲!
<input type="button" name="name" value="我更骄傲"/>
</span> 如果发现我邪恶了,请记住,我曾纯洁过.
传智播客<div style=" width: 300px; height: 200px; background-color: Yellow; display: inline; ">官网</div>http://www.itcast.cn
<br /> 传智播客<span style=" width: 300px; height: 200px; background-color: Yellow; display: block; ">官网</span>http://www.itcast.cn </body>
</html>

04 CSS中常用的几个属性

05常见的几个CSS属性

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<div style="width: 500px; height: 300px; background-color: white; border: 1px solid red; color: black; cursor: pointer;"> 另外一种方法cursor: url(dinosaru.ani);
<input type="button" name="name" value="我是老马,点我,狠点" />
如果我邪恶了,请记住,我曾经纯洁过。 <ul style="list-style-type:none;padding:0">
<li>靠,又变帅了</li>
<li>靠,又变帅了</li>
<li>靠,又变帅了</li>
<li>靠,又变帅了</li>
<li>靠,又变帅了</li>
</ul>
<table style="border:1px red solid">区分border="1", 只有外边框,没有单元格的边框
<tr>
<td>123456</td>
<td>123456</td>
<td>123456</td>
<td>123456</td>
</tr>
<tr>
<td>123456</td>
<td>123456</td>
<td>123456</td>
<td>123456</td>
</tr>
<tr>
<td>123456</td>
<td>123456</td>
<td>123456</td>
<td>123456</td>
</tr>
<tr>
<td>123456</td>
<td>123456</td>
<td>123456</td>
<td>123456</td>
</tr>
</table>
</div>
</body>
</html>

06.三个选择器

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<!--第二种情况:写CSS代码,在本页面上写-->
<style type="text/css">
#dv /*id选择器*/
{
width: 300px;
height: 200px;
background-color:orange;
border:1px solid red;
}
/*运用于全部的DIV控件层,但是如果同时存在ID选择器及DIV层,则存在优先级设置样式*/
div /*标签选择器*/
{
cursor: pointer;
font-family: 全新硬笔行书简;
color: blue;
}
.cls /*类选择器*/ {
width: 300px;
height: 200px;
background-color: orange; /*当同时存在同一个属性的时候,以排序后面的为准。*/
}
.cls1 /*同一个标签,可以使用多个类选择器*/
{
color: red;
background-color: yellow; /*当同时存在同一个属性的时候,以排序后面的为准。*/
}
/*#dv--表示的是ID选择器,通常用在特定或者指定的某个元素上使用
div--表示的是标签选择器,通常用在很多相同标签上,希望这些标签都是用一个标签
.cls--表示的是类选择器,通常用在不同标签上,一般是几个标签(不同)应用同一个样式 优先级别:第一种情况中的就近原则 >> ID选择器最高 >> 类选择器 >>标签选择器
例子:第一步,如果div标签,则一定会先设置了div标签样式,然后再覆盖其它选择器的样式。
*/
</style> </head>
<body>
<!--第一种情况:写CSS代码,直接在HTML标签里面填写,-->
<div style="width:300px;height:200px;">
<!--id选择器-->
老马有才:文能提笔控萝莉
</div>
<!--第二种情况:写CSS代码,在本页面上写,使用ID选择器,则样式的优先级属于ID选择器-->
<div id="dv" ><!--id选择器-->
老马有才:文能提笔控萝莉
</div> <div class="cls cls1" > <!--/*同一个标签,可以使用多个类选择器*/-->
老马看到了老苏洗澡/*当同时存在同一个属性的时候,以排序后面的为准。*/
</div>
<div>
老马看到了老苏洗澡
</div>
<div>
老马看到了老苏洗澡
</div>
<input class="cls" type="button" name="name" value="我是按钮"/>
<input type="text" name="name" value="我是文本框"/>
<a href="http://www.xuanjics.com">玄机论坛</a>
</body>
</html>

07其它选择器

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
/*类名相同,但是不同标签就应用不同的样式,标签+类选择器*/
input.cls {
background-color: black;
width: 200px;
height: 100px;
} div.cls {
background-color: yellow;
width: 500px;
height: 300px;
}
/*类名相同,但是不同标签就应用不同的样式*/ div p span /*包含选择器(层次选择器),写死了。*/
{
background-color: blue;
}
</style>
</head>
<body>
<input class="cls" type="button" name="name" value="我是按钮。" />
<div class="cls">
我是层。
</div>
<div>
<p>
<span>
我是Span
</span>
</p>
</div>
</body>
</html>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<style type="text/css">
/*伪选择器,不常用*/
a:link
{
text-decoration:none;
color:black;
}
a:hover
{
text-decoration:underline;
color:red;
}
a:active
{
color:yellow;
text-decoration:none;
}
a:visited
{
color:blue;
text-decoration:underline;
}
</style>
</head>
<body>
<a href="http://www.xuanjics.com">
玄机论坛,技术高手论坛
</a>
</body>
</html>

08几种使用CSS样式的方法

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<style type="text/css">
/*伪选择器,不常用,第二种(页面嵌入)使用CSS的方式*/
a:link
{
text-decoration:none;
color:black;
}
a:hover
{
text-decoration:underline;
color:red;
}
a:active
{
color:yellow;
text-decoration:none;
}
a:visited
{
color:blue;
text-decoration:underline;
}
/*第二种(页面嵌入)使用CSS的方式*/
div {
background-color: blue;
width: 100px;
height: 300px;
}
</style>
<!--/*第三种:使用CSS方式,外部引用*/-->
<link href="01.css" rel="stylesheet" /> >
<!--/*当同时使用多个CSS文件的时候,则会合并到一个ALL.css中*/-->
<link href="All.css" rel="stylesheet" />
</head>
<body>
<a href="http://www.xuanjics.com">
玄机论坛,技术高手论坛
</a>
<div style=" width:200px;height:500px;" > <!--第一种(元素内联)使用CSS的方式,直接在标签里面写CSS样式-->
玄机论坛,技术高手论坛
</div>
<div >
玄机论坛,技术高手论坛
</div>
</body>
</html> 01.css div {
background-color: yellow;
width: 500px;
height: 300px;
} 02.css div {
border:1px solid red;
}
all.cs @import url(01.css);
@import url(02.css);

09 脱离文档流

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<style type="text/css">
#dv1 {
background-color: red;
width: 300px;
height: 150px;
position: relative; /*脱离文档流,相当于之前的位置,相对定位*/
left: 100px; /*虽然已经脱离,但是后面的元素不会占了位置*/
top: 50px;
}
#dv2 {
background-color: green;
width: 300px;
height: 150px;
position: absolute; /*脱离文档流,绝对定位,相对于body*/
left: 500px; /*已经脱离,则后面的元素会占了位置*/
top: 50px;
z-index: 1001;/*值越大就越上面*/
}
#dv3 {
background-color: blue;
width: 300px;
height: 150px;
position:fixed;/*脱离文档流,固定定位,相对于浏览器平面*/ }
#dv4 {
background-color: green;
width: 300px;
height: 150px;
position: absolute; /*脱离文档流,绝对定位,相对于body*/
left: 500px; /*已经脱离,则后面的元素会占了位置*/
top: 50px;
z-index: 1000; /*值越大就越上面*/
}
</style>
</head>
<body>
<div id="dv1"> </div>
<div id="dv2"> </div>
<div id="dv3"> </div>
</body>
</html>

11 div和CSS布局

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<!--<script type="text/javascript">
window.onload = function() {
document.onclick = function () {
alert('我的范围');
};
document.body.onclick = function () {
alert('Body的范围');
};
};
</script>--> </head>
<body>
<div style="width: 90%; border: 1px solid red; margin: 0 auto; margin-bottom: 10px; ">
<!--margin: 0 auto; 设置居中显示。margin-bottom:10px;设置俩个DIV距离-->
<img src="imgs/01.png" />
</div>
<div>
<img src="imgs/02.png" />
</div>
<div>
<img src="imgs/03.png" />
</div>
<div>
<img src="imgs/04.png" />
</div>
<div id="dvbig"style="border:1px solid red;">
<div style="float:left;"><!--浮动向左边靠-->
<img src="imgs/05.png" />
</div>
<div style="float:left; margin-left:20px;"><!--浮动向左边靠-->
<img src="imgs/06.png" />
</div>
</div>
<div>
<img src="imgs/07.png" />
</div>
</body>
</html>

12 浮动的问题

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
大家好,你们好,你好,我也好。
下面的俩个DIV没有内容,则会导致第三个DIV会出现混乱排序,需要清除浮动的效果。
<div style="background:red;width:500px;height:200px;float:left;"> </div>
<div style="background:green;width:500px;height:200px;float:right;"> </div>
<div style="background:blue;width:500px;height:200px;clear:both;">
<!--clear:both; 清除浮动,对于有时使用float会导致排序混乱的时候,则需要清除浮动。-->
</div>
</body>
</html>

13. 盒子模型

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<div style="width:300px;height:200px;border:10px solid red ">
<input type="button" name="name" value="按钮"
style="width:100px;height:50px;
border:5px solid blue; margin:50px;"/>
</div>
<!--div层,设置的大小,不包括边框大小,只算空白部分。-->
<!--input,设置的大小,包括边框大小。-->
</body>
</html>

14.框架

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<!--frameset rows="30%,*">
根据此例子,可以对页面进行分块。
<frameset cols="30%,*"> <frame src="08伪选择器.html" />
<frame src="13盒子模型.html" />
</frameset>
<frameset cols="30%,30%,*">
<frame src="13盒子模型.html" />
<frame src="08伪选择器.html" />
<frame src="13盒子模型.html" />
</frameset>
</frameset>--> <frameset rows="30%,70%" cols="50%,50%">
<frame src="13盒子模型.html" noresize/><!--noresize,设置不可以拉动窗口。-->
<frameset cols="30%,*">
<frame src="08伪选择器.html" noresize />
<frame src="13盒子模型.html" noresize />
</frameset>
<noframes>
<body>当浏览器不支持框架时,则显示这个body中内容。</body>
</noframes>
</frameset> </html>

15 介绍JavaScript

1.JavaScript基本语法

2.JavaScript Dom(JavaScript操作html页面)

16 JS基本代码

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<!--<script type="text/javascript"> 如果放在前面,则会卡住页面加载信息。
var newDate = new Date();
alert(newDate.toLocaleDateString());
alert(newDate.toLocaleTimeString());
</script>--> </head>
<body> </body>
</html>
<!--script放在后面再加载,有利于客户体验。让网页页面先加载,再加载JS代码。-->
<script type="text/javascript">
var newDate = new Date();
alert(newDate.toLocaleDateString());
alert(newDate.toLocaleTimeString());
</script>
<script type="text/javascript"> alert('哈哈,我今天又变帅了。');
alert('我今天学习了<' + '/script>');
</script>
<!--如果包含了字符"</script>",则会出错,使用字符串拼接的方法-->

23----2013.07.01---Div和Span区别,Css常用属性,选择器,使用css的方式,脱离文档流,div+css布局,盒子模型,框架,js基本介绍的更多相关文章

  1. CSS布局之脱离文档流详解——浮动、绝对定位脱离文档流的区别

    1.代码 (1)示例代码1 <!DOCTYPE html> <html lang="zh"> <head> <meta charset=& ...

  2. 脱离文档流两操作,float和position:absolute的区别

    文档流:将窗体自上而下分成一行行, 并在每行中按从左至右的顺序排放元素,块状元素独占一行,内联元素不独占一行: CSS中脱离文档流,也就是将元素从普通的布局排版中拿走,其他盒子在定位的时候,会当做脱离 ...

  3. HTML+CSS基础 块级元素div分析 文档流 脱离文档流的方法

    块级元素div分析 1.外边距  margin 2.内边距 padding 3.边框  border Div的真实宽度=width+margin-left+margin-right+border*2+ ...

  4. float 浮动 文档流和文字流区别

    关于float属性的脱离文档流的问题 使用float浮动后,元素虽然会脱离文档流,但还处在文本流的位置当中,所以就不会出现重叠的效果吗? 下面我自己试了一下,给两个DIV分别设置了样式,而只给第一个D ...

  5. div排版+文档流+定位秘诀

    由于没有找到自己认为完整的关于普通流.浮动和绝对定位的中文文章,于是鼓起勇气决定自己来写篇. 在普通流中的 Box(框) 属于一种 formatting context(格式化上下文) ,类型可以是 ...

  6. [转]div与span区别及用法

    DIV与SPAN区别及div与san用法篇 接下来了解在div+css开发的时候在html网页制作,特别是标签运用中div和span的区别及用法.新手在使用web标准(div css)开发网页的时候, ...

  7. div与span区别及用法

    DIV与SPAN区别及div与san用法篇 接下来了解在div+css开发的时候在html网页制作,特别是标签运用中div和span的区别及用法.新手在使用web标准(div css)开发网页的时候, ...

  8. DIV 和 SPAN 区别

    DIV 和 SPAN 元素最大的特点是默认都没有对元素内的对象进行任何格式化渲染.主要用于应用样式表(共同点). 两者最明显的区别在于DIV是块元素,而SPAN是行内元素(也译作内嵌元素). 详解:1 ...

  9. css常用属性总结之 id和class的区别,使用类还是ID?

    前面两篇文章我们分别谈到了class和id的相关知识和如何使用,但是在实际项目中,我们该如何抉择,class还是id? 先回顾下两者的区别吧! 1.id具有唯一性,class具有普遍性,所以一个页面同 ...

随机推荐

  1. Cross-Browser HTML5 Placeholder Text

    One of the nice enhancement in HTML5 web form is being able to add placeholder text to input fields. ...

  2. Orchard官方文档

    开始使用 安装Orchard 通过Orchard zip文件安装 使用WebMatrix开发Orchard Dashboard总览 创建你的第一个Orchard站点 导航和菜单 添加博客 新增管理媒体 ...

  3. HttpRequest类

    一.HttpRequest的作用 HttpRequest的作用是令到Asp.net能够读取客户端发送HTTP值.比如表单.URL.Cookie传递过来的参数. 返回字符串的那些值就不说了,那些基本上都 ...

  4. Educational Codeforces Round 4 B. HDD is Outdated Technology 暴力

    B. HDD is Outdated Technology 题目连接: http://www.codeforces.com/contest/612/problem/B Description HDD ...

  5. (转)用AGG实现高质量图形输出(二)

    本文上接<用AGG实现高质量图形输出(一)>,分别介绍了AGG显示流程中的各个环节. 上次讲了AGG的显示原理并举了一个简单的例子,这一篇文章开始讲AGG工作流程里的每个环节.为了方便对照 ...

  6. Nmap 源代码学习四 软件简单使用

    软件安装环境是win7.使用Zenmap, nmap6.49BETA2 扫描主机port nmap -T4 -A -v 192.168.0.207 输出结果: 扫描整个子网 nmap 192.168. ...

  7. TP复习2

    ## ThinkPHP 3.1.2 输出和模型使用#讲师:赵桐正微博:http://weibo.com/zhaotongzheng 本节课大纲:M() 等效为 new Model();$m=M('Us ...

  8. Android之桌面组件AppWidget

    转载:Android之桌面组件App Widget初探 Android开发应用除了程序应用,还有App Widget应用.好多人会开发程序应用而不会开发App Widget应用.本帖子就是帮助大家学习 ...

  9. docker + swarm 集群

    docker + swarm 集群 导读 Swarm是Docker公司在2014年12月初新发布的容器管理工具.和Swarm一起发布的Docker管理工具还有Machine以及Compose.Swar ...

  10. 动态引入Js文件

    var src = "/Scripts/Test.js"; $("<script type = 'text/javascript' src='" + sr ...