黑马程序员05-Web前端学习笔记

部分资源地址 绿叶学习网

前端开发系统化学习,包括html、css、PC端及移动端布局技巧、javascript、jquery、js特效制作、ajax前后台交互等。

HTML

一个HTML文档由4个基本部分组成:

  • ① 一个文档声明:
  • ② 一个html标签对:
  • ③ 一个head标签对:
  • ④ 一个body标签对:

html5是向下兼容的文档,用sublime text创建方法: html:5 + tab 或者 ! + tab

一般来说,只有6个标签能放在标签内:

;② <meta>;keywords description<span style="white-space:pre"> </span>author <span style="white-space:pre"></span>copyright</p> <p>③ <link>;④ <style>;⑤ <script></p> <p><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)">meta标签有两个重要的属性name和http-equiv。</span><br> </p> <p></p> <pre><code>实体:  “<” 和 “>” 的字符实体为 < 和 ></code></pre> <p><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)">空格“ ”,在前端界又称为“牛逼SP”</span><br> </p> </div> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <p>语义化可以给我们带来什么样的好处呢?</p> </div> <div> <p><strong>1. <span style="font-family:宋体">更容易被搜索引擎收录。</span></strong></p> </div> <div> <p><strong>2. <span style="font-family:宋体">更容易让屏幕阅读器读出网页内容。</span></strong></p> </div> </blockquote> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <h2><strong><span style="color:#14191e"><span style="font-size:18px"><hr>标签,添加水平横线  <br>换行</span></span></strong></h2> </div> </blockquote> <div>         <span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)">div,即division(分区)</span> </div> <div> <div style="text-indent:30px"> <span style="font-family:Microsoft YaHei,Arial,Helvetica,sans-serif; color:#1a1a1a"></span> <p style="font-size:15px; padding-top:0px; padding-bottom:0px; margin-bottom:8px; text-indent:30px; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)"> HTML元素根据表现形式,可以分为2类:</p> <ul class="items" style="padding:0px; margin:0px 0px 8px; list-style:none; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; background-color:rgb(255,255,255)"> <li style="text-indent:30px; font-weight:bold">(1)块元素(block);</li> </ul> <span class="space" style="font-weight:bold; font-size:15px; white-space:pre; display:inline-block; text-indent:2em; line-height:inherit"> </span> <span class="space" style="font-weight:bold; font-size:15px; white-space:pre; display:inline-block; text-indent:2em; line-height:inherit"> </span> <ul class="items" style="padding:0px; margin:0px 0px 8px; list-style:none; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)"> <li style="text-indent:30px"><span style="font-size:12px"><span class="space" style="white-space:pre; display:inline-block; text-indent:2em; line-height:inherit"> </span>(1)独占一行,排斥其他元素跟其位于同一行,包括块元素和行内元素;</span></li> <li style="text-indent:30px"><span style="font-size:12px"><span class="space" style="white-space:pre; display:inline-block; text-indent:2em; line-height:inherit"> </span>(2)块元素内部可以容纳其他块元素或行元素;</span></li> </ul> <br> <ul class="items" style="padding:0px; margin:0px 0px 8px; list-style:none; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)"> <li style="text-indent:30px"><span style="font-size:15px"><strong>(2)行内元素(inline);</strong></span><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-indent:30px; background-color:rgb(255,255,255)"><span style="font-size:12px">行内元素默认显示状态可以与其他行内元素共存在同一行。</span></span></li> </ul> <p style="font-size:15px; padding-top:0px; padding-bottom:0px; margin-bottom:8px; text-indent:30px; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)"> <strong>任何HTML元素都属于这两类中的其中一类。</strong></p> <p style="font-size:15px; padding-top:0px; padding-bottom:0px; margin-bottom:8px; text-indent:30px; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)"> <span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><br> </span></p> <p style="font-size:15px; padding-top:0px; padding-bottom:0px; margin-bottom:8px; text-indent:30px; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)"> <span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)">ul元素内部的子元素只能是li元素,不能是其他元素,<span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)">无序列表列表项符号由list-style-type属性定义,到时候应该摒弃type属性</span></span><br> </p> <span class="space" style="white-space:pre; display:inline-block; text-indent:2em; line-height:inherit"> 网</span> <span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)">页语义结构良好,对于搜索引擎来说也是极为重要的一点。</span> <br> </div> <div style="text-indent:30px"> <span style="font-family:Microsoft YaHei,Arial,Helvetica,sans-serif; color:#1a1a1a"><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><br> </span></span> </div> <p><span style="font-size:14px"><span> <img src="图片地址" alt="图片描述(给搜索引擎看)" title="图片描述(给用户看)"></span><br> </span></p> <p><span><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-indent:30px; background-color:rgb(255,255,255)"><strong><span style="font-size:14px">title属性的值往往都是跟alt属性的值相同,一个是给读者用户看,一个是给搜索引擎看。</span></strong></span><br> </span></p> <p><span><span><a href="链接地址" target="目标窗口的打开方式">超链接文字</a>  <span>一般情况下,target只用到“_self”和“_blank”这两个属性值</span></span><br> </span></p> <p><span style="text-align:center"></span></p> <p><strong>超链接根据链接对象的不同分为:</strong></p> <p>(1)外部链接</p> <p>(2)内部链接:a.内部页面链接(同域名下面);b.锚点链接(目录);</p> <p><br> </p> <p><strong><span>表单元素不一定都要放在form标签</span><span>内。对于要与服务器进行交互(也可以说是跟网站后台进行交互)的表单元素就必须放在form标签内才有效</span></strong></p> </div> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <p><span style="font-family:宋体">焦点:</span><label for="male">男</label></p> </div> <div> <p> <span style="white-space:pre"> </span>        <input type="radio" name="gender" id="male" /></p> </div> </blockquote> <p><span style="white-space:pre"></span></p> <div> <span style="font-size:12px"><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-indent:30px; background-color:rgb(255,255,255)"><strong>普通按钮一般与JavaScript脚本结合在一起来实现一些特效,提交按钮主要用于把当前所在<form>标签内部的表单输入信息提交给服务器处理,而重置按钮则是清除当前所在<form>标签内部的表单元素的输入信息。</strong></span><br> </span> </div> <div> <span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><br> </span></span> </div> <div> <span style="font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><span style="color:#ff0000">文本框有3种形式:单行文本框text、密码文本框password和多行文本框,textarea。单行文本框和密码文本框使用的是input标签,而多行文本框使用的是textarea标签。</span><br> </span> </div> <div> <span style="font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><span style="color:#ff0000"><br> </span></span> </div> <div> <span style="font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><span style="color:#ff0000"><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><button>标签与表单按钮相比,<button>标签开始符号与结束符号之间可以插入其他标签或文本,因此它的功能更加强大。</span><span style="font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)">插入图片</span><br> </span></span> </div> <div> <span style="font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><span style="color:#ff0000"><span style="font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><br> </span></span></span> </div> <div> <span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)">embed是HTML5新增的标签。</span><br> </span> </div> <p><strong><embed src="多媒体文件地址" width="播放界面的宽度" height="播放界面的高度"></embed></strong></p> <p><span style="">“ ./ ” 表示当前文件所在目录下,<span style="">“ ../ ” 表示当前文件所在目录下的上一级目录,<span style="">比如:“../images/pic.jpg” 表示当前目录下的上一级目录下的images文件夹中的pic.jpg的图片</span></span></span></p> <p><span style=""><span style=""><span style=""></span></span></span></p> <pre><code class="language-html"><!DOCTYPE HTML> <html> <head> <!--网页关键字--> <meta name="keywords" content="绿叶学习网"/> <!--网页描述--> <meta name="description" content="绿叶学习网是一个富有活力的技术学习网站"/> <!--本页作者--> <meta name="author" content="helicopter"> <!--版权声明--> <meta name="copyright" content="本站所有教程均为原创,版权所有,禁止转载。否则将追究法律责任。"/> <!-- 编码 --> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <!-- 自动跳转 --> <!-- <meta http-equiv="refresh" content="6;url=http://www.baidu.com"/> --> <link rel="stylesheet" type="text/css" title="temp" href="/temp.css/"> <style type="text/css"> </style> </head> <body> <h1>这是一级标题</h1> <h2>这是二级标题</h2> <h3>这是三级标题</h3> <h4>这是四级标题</h4> <h5>这是五级标题</h5> <br/> <!-- 换行标签是自闭合标签 ,其中br指的是“break(换行)”。 --> <h6>这是六级标题</h6> <strong>这是粗体文本</strong><br/> <i>斜体文本</i><br/> <cite>斜体文本</cite><br/> <!-- 对文本进行斜体设置,尽量用<em>标签 --> <em>斜体文本</em> <p>(a+b)<sup>2</sup>=a<sup>2</sup>+b<sup>2</sup>+2ab</p> <p>H<sub>2</sub>SO<sub>4</sub>指的是硫酸分子</p> <!-- 学了CSS之后,对于删除线效果,一般采用CSS实现,极少使用<s>标签实现。 --> <p><s>原价:¥6.50/kg</s><br><strong>现在仅售:¥4.00/kg</strong></p> <hr/> <p>欧元符号:€</p> <p>英镑符号:£</p> <p>方式2</p> <p>欧元符号:€</p> <p>英镑符号:£</p> <hr> <ol> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> <li>jQuery</li> <li>Ajax</li> <li>SEO</li> <li>ASP.NET</li> </ol> <hr> <ul> <li>无序列表项</li> <li>无序列表项</li> <li>无序列表项</li> </ul> <p>定义列表</p> <dl> <dt>HTML</dt> <dd>制作网页的标准语言,控制网页的结构</dd> <dt>CSS</dt> <dd>层叠样式表,控制网页的样式</dd> <dt>JavaScript</dt> <dd>脚本语言,控制网页的行为</dd> </dl> <!-- tr,即“table row(表格行)”。td,即“table data cell(表格单元格)”。 --> <table> <caption>表格标题</caption> <tr> <td>单元格1</td> <td>单元格2</td> </tr> <tr> <td>单元格1</td> <td>单元格2</td> </tr> </table> <hr> <a href="http://www.baidu.com" target="_blank">百度一下</a> <p>内部链接</p> <div> <a href="#music">推荐音乐</a><br /> <a href="#movie">推荐电影</a><br /> <a href="#article">推荐文章</a><br /> </div> ……<br /> ……<br /> ……<br /> ……<br /> ……<br /> ……<br /> <div id="music"> <h3>推荐音乐</h3> <ul> <li>林俊杰-被风吹过的下图</li> <li>曲婉婷-在我的歌声里</li> <li>许嵩-灰色头像</li> </ul> </div> ……<br /> ……<br /> ……<br /> ……<br /> ……<br /> ……<br /> <div id="movie"> <h3>推荐电影</h3> <ul> <li>蜘蛛侠系列</li> <li>钢铁侠系统</li> <li>复仇者联盟</li> </ul> </div> ……<br /> ……<br /> ……<br /> ……<br /> ……<br /> ……<br /> <div id="article"> <h3>推荐文章</h3> <ul> <li>朱自清-荷塘月色</li> <li>余光中-乡愁</li> <li>鲁迅-阿Q正传</li> </ul> </div> <hr> <a href="void:"><p>如果您对我任何意见和建议,请发邮件给我们</p> <form name="form1" action="mailto:1096221710@qq.com" method="post"></form></a><hr> <div id="main"> <h3>springlee网</h3> <iframe src="http://www.baidu.com" width="400px" height="300px" scrolling="no"></iframe> </div> </body> <script type="text/javascript"> </script> </html></code></pre> <p></p> <p><span style="font-size:36px; text-align:center">                                CSS</span></p> <p><span style="font-weight:bold"><span><span><span><br> </span></span></span></span></p> <p>在HTML中引入CSS共有3种方式:</p> <ul class="items" style="list-style:none; margin:0px 0px 8px; padding:0px; color:rgb(26,26,26); font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif; font-size:15px"> <ul> <li style="text-align:left; text-indent:30px"><strong>(1)外部样式表;<code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important"><</code><code class="html keyword" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:red!important">link</code><span style="color:rgb(53,107,67); font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; white-space:pre; background-color:rgb(255,253,226)"></span><code class="html color1" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:gray!important">href</code><code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">=</code><code class="html string" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:blue!important">"index.css"</code><span style="color:rgb(53,107,67); font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; white-space:pre; background-color:rgb(255,253,226)"></span><code class="html color1" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:gray!important">rel</code><code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">=</code><code class="html string" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:blue!important">"stylesheet"</code><span style="color:rgb(53,107,67); font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; white-space:pre; background-color:rgb(255,253,226)"></span><code class="html color1" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:gray!important">type</code><code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">=</code><code class="html string" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:blue!important">"text/css"</code><span style="color:rgb(53,107,67); font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; white-space:pre; background-color:rgb(255,253,226)"></span><code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">/></code></strong></li> <li style="text-align:left; text-indent:30px"><strong>(2)内部样式表;</strong> <div class="line number6 index5 alt1" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; color:rgb(53,107,67); position:static!important; background:none rgb(255,253,226)!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px 1em!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; min-height:auto!important; white-space:pre!important"> <code class="html spaces" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important"> </code> <code class="html plain" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:black!important"><</code> <code class="html keyword" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:red!important">style</code> <code class="html color1" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:gray!important">type</code> <code class="html plain" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:black!important">=</code> <code class="html string" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:blue!important">"text/css"</code> <code class="html plain" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:black!important">></code> </div> <div class="line number7 index6 alt2" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; color:rgb(53,107,67); position:static!important; background:none rgb(255,253,226)!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px 1em!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; min-height:auto!important; white-space:pre!important"> <code class="html spaces" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important">        </code> <code class="html plain" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:black!important">p{color:Red;}</code> </div> <div class="line number8 index7 alt1" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; color:rgb(53,107,67); position:static!important; background:none rgb(255,253,226)!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px 1em!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; min-height:auto!important; white-space:pre!important"> <code class="html spaces" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important"> </code> <code class="html plain" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:black!important"></</code> <code class="html keyword" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:red!important">style</code> <code class="html plain" style="background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; font-size:1em!important; min-height:auto!important; color:black!important">></code> </div> </li> <li style="text-align:left; text-indent:30px"><strong>(3)内联样式表;<code class="html spaces" style="font-size:13px; color:rgb(53,107,67); white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important">  </code><code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important"><</code><code class="html keyword" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:red!important">p</code><span style="color:rgb(53,107,67); font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; white-space:pre; background-color:rgb(255,253,226)"></span><code class="html color1" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:gray!important">style</code><code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">=</code><code class="html string" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:blue!important">"color:Red; "</code><code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">>绿叶学习网</</code><code class="html keyword" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:red!important">p</code><code class="html plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">></code></strong></li> </ul> </ul> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <div style="text-align:left"> <span style="font-family:Microsoft YaHei,Arial,Helvetica,sans-serif; color:#1a1a1a"><span style="font-size:15px"><strong><span><span style="color:rgb(51,51,51); font-family:"Helvetica Neue",Helvetica,Arial,sans-serif; font-size:16px; letter-spacing:0.2px; orphans:3; widows:3">选择器 { 属性:值; 属性:值; 属性:值;}</span><br> </span></strong></span></span> </div> <div style="text-align:left"> <span style="font-family:Microsoft YaHei,Arial,Helvetica,sans-serif; color:#1a1a1a"><span style="font-size:15px"><strong><span><br> </span></strong></span></span> </div> <div style="text-align:left"> <span style="font-family:Microsoft YaHei,Arial,Helvetica,sans-serif; color:#1a1a1a"><span style="font-size:15px"><strong><span>height:auto,是指根据块内内容自动调节高度。</span></strong></span></span> </div> </div> <div> <div style="text-align:left"> <span style="font-family:Microsoft YaHei,Arial,Helvetica,sans-serif; color:#1a1a1a"><span style="font-size:15px"><strong><span>height:100%,是指其相对父块高度而定义的高度,也就是按照离它最近且有定义高度的父层的高度来定义高度。</span></strong></span></span> </div> </div> <div> <div style="text-align:left"> <p><span style="color:#ff00">p{color:red !important;}  //<span style="font-family:宋体">设置具有最高权值</span></span></p> <p><span style="color:#ff00"><span style="font-family:宋体"><br> </span></span></p> </div> </div> </blockquote> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <div style="text-align:left"> <span style="font-family:Microsoft YaHei,Arial,Helvetica,sans-serif; color:#1a1a1a"><span style="font-size:15px"><strong><span>我们可以使用CSS的</span><span style="display:inline-block; position:relative">text-indent属性</span><span>来控制文本首行的缩进。</span></strong></span></span> </div> </div> <div> <div style="text-align:left"> <span style="color:rgb(26,26,26); font-family:Microsoft YaHei,Arial,Helvetica,sans-serif"><span style="font-size:15px"><span style="font-weight:bold"><span><span>在CSS中,使用</span><span style="display:inline-block; position:relative">text-align属性</span><span>控制文本的水平方向的对齐方式:左对齐、居中对齐、右对齐。</span></span></span></span></span> </div> </div> <div> <div style="text-align:left"> <p>  边框CSS样式有一个简洁的写法: <span>border:1px solid gray;</span></p> </div> </div> <div> <div style="text-align:left"> <span style="white-space:pre"><span>定义这四个伪类,必须按照“link、visited、hover、active”</span><span>“</span><span><strong>l</strong></span><span>o</span><span><strong>v</strong></span><span>e </span><span><strong>h</strong></span><span><strong>a</strong></span><span>te”</span></span> </div> </div> </blockquote> <div> <div style="text-align:left"> <span style="color:rgb(238,39,119); font-family:Times New Roman"><span style="white-space:pre"><span style="color:rgb(26,26,26); text-indent:30px; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif"><span><strong><span style="font-size:15px; white-space:pre"></span><span style="font-size:15px"><span style="white-space:pre"></span>请记住,</span><span style="font-size:32px">“:hover”伪类可以定义任何一个元素在鼠标经过时的样式!</span></strong></span><span style="font-size:15px"><br> </span></span></span></span> </div> <div style="text-align:left"></div> <div style="text-align:left"> <span style="color:rgb(238,39,119); font-family:Times New Roman"><span style="font-size:15px"><span style="white-space:pre"><span style="color:rgb(26,26,26); text-indent:30px; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif; font-size:15px"><span><strong><span><span style="white-space:pre"></span>一般情况下,我们只需要采用浏览器默认的鼠标样式就可以了,如果实在特别需要的时候可以用“cursor:pointer;”。对于cursor的其他属性值,我们一般用不上。因此大家无需花力气去记忆这些没用的属性。</span><br> </strong></span></span></span></span></span> </div> <div style="text-align:left"> <span style="color:rgb(238,39,119); font-family:Times New Roman"><span style="font-size:15px"><span style="white-space:pre"><span style="color:rgb(26,26,26); text-indent:30px; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif; font-size:15px"><span><strong><span><span><br> </span></span></strong></span></span></span></span></span> </div> <div style="text-align:left"> <span style="white-space:pre"></span>  <span style="font-size:18px"><strong>  文字属性:</strong></span> </div> <div style="text-align:left"> <ul style=""> <li style=""> <p style=""><span style="font-size:12px">line-height 设置文字的行高,如:line-height:24px;</span></p> </li> <li style=""> <p style=""><span style="font-size:12px">text-decoration 设置文字的下划线,如:text-decoration:none; 将文字下划线去掉</span></p> </li> <li style=""> <p style=""><span style="font-size:12px">text-indent 设置文字首行缩进,如:text-indent:24px; 设置文字首行缩进24px</span></p> </li> <li style=""> <p style=""><span style="font-size:12px">text-align 设置文字水平对齐方式,如text-align:center 设置文字水平居</span></p> </li> </ul> </div> <div style="text-align:left"> <span><span></span></span> <ul style=""> <li style="">盒子宽度 = width + padding左右 + border左右</li> </ul> </div> </div> <blockquote style="margin:0 0 0 40px; border:none; padding:0px"> <div> <div style="text-align:left"> <span><span></span></span> <p style=""><span style="">margin相关技巧 </span></p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">1、设置元素水平居中: margin:x auto;</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">2、margin负值让元素位移及边框合并</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style=""><span style="">外边距合并</span></p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">外边距合并指的是,当两个垂直外边距相遇时,它们将形成一个外边距。合并后的外边距的高度等于两个发生合并的外边距的高度中的较大者。解决方法如下:</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">1、使用这种特性</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">2、设置一边的外边距,一般设置margin-top</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">3、将元素浮动或者定位</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style=""><span style="">margin-top 塌陷</span></p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">在两个盒子嵌套时候,内部的盒子设置的margin-top会加到外边的盒子上,导致内部的盒子margin-top设置失败,解决方法如下:</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">1、外部盒子设置一个边框</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">2、外部盒子设置 overflow:hidden</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">3、使用伪元素类:</p> <p style=""><br> </p> </div> </div> </blockquote> <div> <div style="text-align:left"> <span><span><span style="font-size:24px">css的布局模型(定位机制):</span></span></span> </div> <div style="text-align:left"> <span><span></span></span> <div> <span style="color:rgb(238,39,119); font-family:'Times New Roman'"><span style="font-size:15px"><span style="white-space:pre"><span><strong></strong></span></span></span></span> </div> <p style="">我们可以使用css的position属性来设置元素的定位类型,postion的设置项如下:</p> <ul style=""> <li style="">relative 生成相对定位元素,元素所占据的文档流的位置不变,元素本身相对文档流的位置进行偏移</li> <li style="">absolute 生成绝对定位元素,元素脱离文档流,不占据文档流的位置,可以理解为漂浮在文档流的上方,相对于上一个设置了相对或者绝对或者固定定位的父级元素来进行定位,如果找不到,则相对于body元素进行定位。</li> <li style="">fixed 生成固定定位元素,元素脱离文档流,不占据文档流的位置,可以理解为漂浮在文档流的上方,相对于浏览器窗口进行定位。</li> <li style="">static 默认值,没有定位,元素出现在正常的文档流中,相当于取消定位属性或者不设置定位属性</li> <li style="">inherit 从父元素继承 position 属性的值</li> </ul> </div> <div style="text-align:left"> <ul style=""> <li style="">background-color 设置背景颜色</li> <li style="">background-image 设置背景图片地址</li> <li style="">background-repeat 设置背景图片如何重复平铺</li> <li style="">background-position 设置背景图片的位置</li> <li style="">background-attachment 设置背景图片是固定还是随着页面滚动条滚动</li> </ul> </div> <div style="text-align:left"> <br> </div> <div style="text-align:left"> <p><strong><span style="font-size:24px">各种居中</span></strong></p> </div> </div> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <div style="text-align:left"> <p><strong>文本、图片等<span style="color:#ff00">行内元素</span>时,水平居中是通过给<span style="color:#ff00">父元素</span><span style="font-family:宋体">设置</span> text-align:center<span style="font-family:宋体">来实现</span></strong></p> </div> </div> <div> <div style="text-align:left"> <p><strong><span style="color:#ff00">定宽和块状</span><span style="font-family:宋体">两个条件的元素是可以通过设置</span>“左右<span style="font-family:Calibri">margin</span><span style="font-family:宋体">”值为“</span><span style="font-family:Calibri">auto</span><span style="font-family:宋体">”来实现居中</span></strong></p> </div> </div> <div> <div style="text-align:left"> <p><span style="font-weight:bold"><span style="font-family:宋体"></span></span></p> </div> </div> <div> <div style="text-align:left"> <p style="text-align:left"><strong><span style="color:#14191e">垂直居中</span></strong></p> </div> </div> <div> <div style="text-align:left"> <p>父元素<span style="color:#ff00">高度确定</span>的单行文本</p> </div> </div> <div> <div style="text-align:left"> <p>   <strong> <span style="white-space:pre"> </span>height:100px;</strong></p> </div> </div> <div> <div style="text-align:left"> <p><strong>    <span style="white-space:pre"> </span>line-height:100px;    //<span style="font-family:宋体">上下参数一样</span></strong></p> </div> </div> <div> <div style="text-align:left"> <p><br> </p> </div> </div> </blockquote> <div> <div style="text-align:left"> <h2><span style="font-weight:bold"><span style="color:#ff0000"><span style="font-size:24px"><span style="font-family:微软雅黑">隐性改变</span>display类型</span></span></span></h2> </div> </div> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <div style="text-align:left"> <p> 1. position : absolute </p> </div> </div> <div> <div style="text-align:left"> <p> <span style="white-space:pre"> </span>2. float : left <span style="font-family:宋体"> 或 </span><span style="font-family:Calibri">float:right </span></p> </div> </div> <div> <div style="text-align:left"> <p><strong><span style="font-family:宋体">简单来说,只要</span>html<span style="font-family:宋体">代码中出现以上两句之一,元素的</span><span style="font-family:Calibri">display</span><span style="font-family:宋体">显示类型就会自动变为以</span><span style="font-family:Calibri">display:inline-block</span><span style="font-family:宋体">(块状元素)的方式显示,当然就可以</span><span style="color:#ff00"><span style="font-family:宋体">设置元素的</span> width<span style="font-family:宋体">和 </span><span style="font-family:Calibri">height</span></span> <span style="font-family:宋体">了,且默认宽度不占满父元素。</span></strong></p> </div> </div> <div> <div style="text-align:left"> <p><span style="font-weight:bold"><span style="font-family:宋体"></span></span></p> </div> </div> <div> <div style="text-align:left"> <p><span style="font-family:宋体">看到一张页面,先不要被绚丽的</span>CSS<span style="font-family:宋体">效果所打扰,</span><span style="color:#ff00"><span style="font-family:宋体">重点是看它的</span>HTML<span style="font-family:宋体">结构和语义化 少用</span><span style="font-family:Calibri">div</span></span></p> </div> </div> </blockquote> <div> <div style="text-align:left"> <p><span style="white-space:pre"></span></p> </div> </div> <div> <div style="text-align:left"> <p style="">  让CSS3样式兼容,需要将某些样式加上浏览器前缀:</p> </div> </div> <blockquote style="margin:0 0 0 40px; border:none; padding:0px"> <blockquote style="margin:0 0 0 40px; border:none; padding:0px"> <div> <div style="text-align:left"> <p style="">-ms- 兼容IE浏览器</p> </div> </div> </blockquote> <blockquote style="margin:0 0 0 40px; border:none; padding:0px"> <div> <div style="text-align:left"> <p style="">-moz- 兼容firefox</p> </div> </div> </blockquote> <blockquote style="margin:0 0 0 40px; border:none; padding:0px"> <div> <div style="text-align:left"> <p style="">-o- 兼容opera</p> </div> </div> </blockquote> <blockquote style="margin:0 0 0 40px; border:none; padding:0px"> <div> <div style="text-align:left"> <p style="">-webkit- 兼容chrome 和 safari</p> </div> </div> </blockquote> </blockquote> <div> <div style="text-align:left"> <br> </div> <div style="text-align:left"> <span><span></span></span> <p style="">h5新增的主要语义化标签如下:</p> </div> </div> <blockquote style="margin:0 0 0 40px; border:none; padding:0px"> <div> <div style="text-align:left"> <span><span></span></span> <p style="">1、header 页面头部、页眉</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">2、nav 页面导航</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">3、article 一篇文章</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">4、section 文章中的章节</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">5、aside 侧边栏</p> </div> </div> <div> <div style="text-align:left"> <span><span></span></span> <p style="">6、footer 页面底部、页脚</p> </div> </div> </blockquote> <div> <h1 style="text-align:center"><span><span><span><strong>JavaScript</strong></span></span></span></h1> <div style="text-align:left"> <span><span><span><span style="font-size:18px"><strong></strong></span></span></span></span> <p style=""><span style="font-size:12px"><span style="font-weight:normal">js作用:</span></span></p> <p style=""><span style="font-size:12px"><span style="font-weight:normal">1、动态改变页面内容<br> </span><span style="font-weight:normal">2、动态改变网页的外观<br> </span><span style="font-weight:normal">3、验证表单数据<br> </span><span style="font-weight:normal">4、响应事件</span></span></p> <p style=""><span style="font-size:12px"><span style="font-weight:normal"><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><strong>什么叫“脚本语言”?</strong></span></span></span><span style="font-weight:bold; text-indent:2em; white-space:pre; background-color:rgb(255,255,255); color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px"> </span></p> <p style=""><span style="font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)"></span></p> <p></p> <ul class="items" style="color:rgb(26,26,26); font-size:15px; padding:0px; margin:0px 0px 8px; list-style:none; font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)"> <li style="text-indent:30px">(1)它不需要编译成二进制,以文本形式存在;</li> </ul> <ul class="items" style="color:rgb(26,26,26); padding:0px; margin:0px 0px 8px; list-style:none; font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)"> <li style="font-size:15px; text-indent:30px">(2)脚本语言一般都需要其他语言的调用执行,不能独立运行。</li> <li style="text-indent:30px"> <p style="padding-top:0px; padding-bottom:0px; margin-bottom:8px; text-indent:30px; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)"> <span style="font-size:12px">JavaScript在HTML的引用共有4种:</span></p> <ul class="items" style="padding:0px; margin:0px 0px 8px; list-style:none; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)"> <li style="text-indent:30px"><strong style="font-size:12px">(1)页头引入(head标签内);</strong><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; text-indent:30px; background-color:rgb(255,255,255)"><span style="font-size:10px"><script type="text/javascript">……</script></span></span></li> <li style="text-indent:30px; font-weight:bold"><span style="font-size:12px">(2)页中引入(body标签内);</span></li> <li style="text-indent:30px"><span style="font-size:12px"><strong>(3)元素事件中引入(标签属性中引入);</strong><code class="js plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important"><input type=</code><code class="js string" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:blue!important">"button"</code><span style="color:rgb(53,107,67); font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; white-space:pre; background-color:rgb(255,253,226)"> </span><code class="js plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">onClick=</code><code class="js string" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:blue!important">"alert('绿叶学习网')"</code><span style="color:rgb(53,107,67); font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace; font-size:13px; white-space:pre; background-color:rgb(255,253,226)"> </span><code class="js plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">value=</code><code class="js string" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:blue!important">"按钮"</code><code class="js plain" style="font-size:13px; white-space:pre; background:none!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important; min-height:auto!important; color:black!important">/></code></span></li> <li style="text-indent:30px; font-weight:bold"><span style="font-size:12px">(4)引入外部JS文件;<span style="color:rgb(238,39,119); font-family:"Times New Roman"; font-size:15px; text-align:center; background-color:rgb(255,255,255)"><script src="js/index.js" type="text/javascript"></script></span></span></li> </ul> </li> </ul> <p></p> <h2 id="调试程序的方法" style=""><span style="font-size:18px">调试程序的方法</span></h2> </div> </div> <blockquote style="margin:0 0 0 40px; border:none; padding:0px"> <div> <div style="text-align:left"> <span><span><span><strong></strong></span></span></span> <p style="">1、alert</p> </div> </div> <div> <div style="text-align:left"> <span><span><span><strong></strong></span></span></span> <p style="">2、console.log</p> </div> </div> <div> <div style="text-align:left"> <span><span><span><strong></strong></span></span></span> <p style="">3、document.title</p> </div> </div> </blockquote> <div> <p><span></span></p> <p>JavaScript数据类型有2大分类:一是“基本数据类型”,二是“特殊数据类型”。</p> <p>其中,基本数据类型包括以下3种:</p> <ul class="items" style="list-style:none; margin:0px 0px 8px; padding:0px; color:rgb(26,26,26); font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif; font-size:15px"> <li style="text-indent:30px">(1)数字型(Number型):如整型84,浮点型3.14;</li> <li style="text-indent:30px">(2)字符串型(String型):如"绿叶学习网";</li> <li style="text-indent:30px">(3)布尔型(Boolean型):true或fasle;</li> </ul> <p>特殊数据类型有3种:</p> <ul class="items" style="list-style:none; margin:0px 0px 8px; padding:0px; color:rgb(26,26,26); font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif; font-size:15px"> <li style="text-indent:30px">(1)空值(null型);</li> <li style="text-indent:30px">(2)未定义值(undefined型);</li> <li style="text-indent:30px">(3)转义字符;</li> <li style="text-indent:30px"><span style="color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-indent:30px; background-color:rgb(255,255,255)"><strong>null不等同于空的字符串("")或0,因为空的字符串("")或0是存在的,但是null表示其不存在的。</strong></span><br> </li> </ul> <p>根据个人的开发经验中,只需要记忆<strong>\n、\'、\</strong>"这3个就已经够初学者走很远了</p> <p> <span class="space" style="white-space:pre; display:inline-block; text-indent:2em; line-height:inherit"> </span>alert("欢迎您来到\"绿叶学习网\"!");<br> </p> <p><span>break语句与continue语句的主要区别是:break是彻底结束循环,而continue是结束本次循环</span></p> <p><span></span></p> <p>常用的函数调用方式有4种:</p> <p>(1)简单调用;   <code class="js spaces" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:rgb(53,107,67); line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important"> </code><code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">alertSum();</code></p> <p>(2)在表达式中调用; <span>document.write(isLeapYear(2015));</span> </p> <p>(3)在事件响应中调用;  <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important"><input type=</code><code class="js string" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:blue!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">"button"</code><span></span><code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">onclick=</code><code class="js string" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:blue!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">"alertMes()"</code><span></span><code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">value=</code><code class="js string" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:blue!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">"提交"</code><code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">/></code></p> <p>(4)通过链接调用;<code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important"><a href=</code><code class="js string" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:blue!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">"javascript:函数名"</code><code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important">></a></code></p> <p><code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre; position:static!important; min-height:auto!important"><span>创建日期对象</span></code></p> </div> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <div class="line number1 index0 alt2" style="background:rgb(255,253,226)!important; margin:0px!important; padding:0px 1em!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:rgb(53,107,67); line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre!important; position:static!important; min-height:auto!important"> <code class="js keyword" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:red!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">var</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">dt1 = </code> <code class="js keyword" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:red!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">new</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">Date(</code> <code class="js string" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:blue!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">"2015-5-3"</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">);</code> </div> </div> <div> <div class="line number2 index1 alt1" style="background:rgb(255,253,226)!important; margin:0px!important; padding:0px 1em!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:rgb(53,107,67); line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre!important; position:static!important; min-height:auto!important"> <code class="js keyword" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:red!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">var</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">dt2 = </code> <code class="js keyword" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:red!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">new</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">Date(</code> <code class="js string" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:blue!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">"May 3,2015"</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">);</code> </div> </div> <div> <div class="line number3 index2 alt2" style="background:rgb(255,253,226)!important; margin:0px!important; padding:0px 1em!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:rgb(53,107,67); line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace; font-size:13px; vertical-align:baseline!important; float:none!important; white-space:pre!important; position:static!important; min-height:auto!important"> <code class="js keyword" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:red!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">var</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">dt3 = </code> <code class="js keyword" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:red!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">new</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">Date(</code> <code class="js string" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:blue!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">"2015/5/3"</code> <code class="js plain" style="background:none!important; margin:0px!important; padding:0px!important; outline:0px!important; border:0px currentColor!important; left:auto!important; top:auto!important; width:auto!important; height:auto!important; right:auto!important; bottom:auto!important; color:black!important; line-height:1.1em!important; overflow:visible!important; font-family:Consolas,'Bitstream Vera Sans Mono','Courier New',Courier,monospace!important; font-size:1em!important; vertical-align:baseline!important; float:none!important; position:static!important; min-height:auto!important">);</code> </div> </div> </blockquote> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <table style="width:674px; color:rgb(26,26,26); font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif; font-size:14px; margin-top:10px; margin-bottom:15px; border-collapse:collapse; border-spacing:0px"> <tbody> <tr style="border-top-color:rgb(223,223,223); border-bottom-color:rgb(223,223,223); border-top-width:1px; border-bottom-width:1px; border-top-style:solid; border-bottom-style:solid; background-color:rgb(243,253,229)"> <td style="margin:0px; padding:0px 0px 0px 10px; width:180px; color:rgb(53,107,67)"> setTimeout()、<span style="white-space:pre"> </span> clearTimeout()</td> <td style="margin:0px; padding:0px 0px 0px 10px; color:rgb(53,107,67)">设置或取消“一次性”执行的定时器</td> </tr> <tr style="border-top-color:rgb(223,223,223); border-bottom-color:rgb(223,223,223); border-top-width:1px; border-bottom-width:1px; border-top-style:solid; border-bottom-style:solid"> <td style="margin:0px; padding:0px 0px 0px 10px; width:180px; color:rgb(53,107,67)"> setInterval()、clearInterval()</td> <td style="margin:0px; padding:0px 0px 0px 10px; color:rgb(53,107,67)">设置或取消“重复性”执行的定时器</td> </tr> </tbody> </table> </div> </blockquote> <div> <p>在JavaScript中,可以通过以下2种方式来选中指定元素:</p> <p>(1)getElementById();</p> <p>(2)getElementsByName();</p> <p></p> <h3 style="padding:0px; margin-top:0px; margin-bottom:0px; font-size:16px; text-indent:14px; height:30px; line-height:30px; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)"> 数组是什么?</h3> <p></p> <p style="padding-top:0px; padding-bottom:0px; margin-bottom:8px; text-indent:30px; color:rgb(26,26,26); font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif; font-size:15px; text-align:left; background-color:rgb(255,255,255)"> 在JavaScript中,我们可以使用“<span style="font-weight:bold">数组</span>”来存储一组“<span style="font-weight:bold">相同数据类型</span>”的数据结构。</p> <p>在JavaScript中我们可以使用innerHTML和innerText这2个属性很方便地获取和设置某一个元素内部子元素或文本。</p> <p>innerHTML属性被多数浏览器所支持,<strong>而innerText只能被IE、chrome等支持而不被Firefox支持。</strong></p> <p><strong></strong></p> <h3 style="margin:0px; padding:0px; height:30px; color:rgb(26,26,26); line-height:30px; text-indent:14px; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif; font-size:16px">      JavaScript操作CSS样式  <span>obj.style.属性名;</span></h3> <div> <span><br> </span> </div> </div> <blockquote style="margin:0px 0px 0px 40px; padding:0px; border:currentColor"> <div> <div> <span><span>JavaScript的DOM操作、事件操作,你就算把绿叶学习网翻烂都要把这些记住,重中之重。</span></span> </div> </div> <div> <span><span><strong>网页动态标题</strong></span></span> </div> <div> <span><span></span></span> <pre><code class="language-html"><!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>

JavaScript的事件很多,包括5大部分:

  • (1)鼠标事件;
  • (2)键盘事件;
  • (3)表单事件;
  • (4)编辑事件;
  •    

    编辑事件有3种:

    • (1)复制事件oncopy;
    • (2)剪切事件oncut;
    • (3)粘贴事件onpaste;
  • (5)页面相关事件;



jQuery


jQuery,顾名思义,也就是JavaScript和Query(查询),即辅助JavaScript开发的库

JQuery加载页面的三种方法:

1.$(document).ready(function(){});

2.$(function(){});

3.jQuery(function($){});

页面载入事件

在jQuery中,对于页面载入事件,我们使用$(document).ready()方法来替代JavaScript中的window.onload方法。

$( function (){
     //代码部分
})

在jQuery中,基本选择器共有:

  • (1)元素选择器;
  • (2)id选择器;
  • (3)class选择器;
  • (4)群组选择器;
  • (5)*选择器

在jQuery中常见的伪类选择器分为以下6种:

  • (1)简单伪类选择器;
  • (2)子元素伪类选择器;
  • (3)可见性伪类选择器;
  • (4)内容伪类选择器;
  • (5)表单伪类选择器;
  • (6)表单属性伪类选择器;

属性操作


$().attr( "属性名" )            //获取属性

$().attr( "属性" , "属性值" )   //设置属性

$().removeAttr( "属性" );       //删除属性

// 获取div的样式
$("div").css("width");
$("div").css("color");


//设置div的样式
$("div").css("width","30px");


内容操作

在jQuery中,关于元素内容操作共有2组方法:

  • (1)html()和text();
  • (2)val();

其中html()和text()用于操作普通标签,而val()用于操作表单标签。

$().width()      //获取元素的宽度
$().width(n)     //设置元素的宽度,n是一个整数,表示npx
$().height()      //获取元素的高度
$().height(n)     //设置元素的高度,n是一个整数,表示npx

插入节点

在jQuery中,常见插入节点的方法共有4组:

  • (1)append()和appendTo();
  • (2)prepend()和prependTo();
  • (3)before()和insertBefore();
  • (4)after()和insertAfter();
动画

一、显示和隐藏

在jQuery中,如果我们想要实现元素的显示和隐藏,可以使用2组方法:

  • (1)show()和hide();
  • (2)toggle();

二、淡入和淡出

在jQuery中,如果我们想要实现元素的淡入淡出这种渐变效果,有3组方法:

  • (1)fadeIn()和fadeOut();
  • (2)fadeToggle();
  • (3)fadeTo();

三、滑上和滑下

在jQuery中,如果我们想要实现元素的滑动效果,也有2组方法:

  • (1)slideUp()和slideDown();
  • (2)slideToggle();

四、自定义动画

在jQuery中,对于自定义动画,我们可以使用animate()方法来实现。对于自定义动画,我们分为2种形式:(1)简单动画;(2)累积动画

实际开发中,一般把阻止冒泡和阻止默认行为合并起来写,合并写法可以用

// event.stopPropagation();
// event.preventDefault();
// 合并写法:
 return false;

JSON

http://www.lvyestudy.com/json/json.aspx

JSON,全称“JavaScript Object Notation(JavaScript对象表示法)”,起源于JavaScript的对象和数组JSON,说白了就是JavaScript用来处理数据的一种格式,这种格式非常简单易用。

JSON,大部分都是用来处理JavaScript和web服务器端之间的数据交换,把后台web服务器的数据传递到前台,然后使用JavaScript进行处理,例如ajax等。

JSON结构共有2种:

  • (1)对象结构;
  • (2)数组结构;
  • 一、JSON对象结构

    对象结构是使用大括号“{}”括起来的,大括号内是由0个或多个用英文逗号分隔的“关键字:值”对(key:value)构成的。

var jsonObj =
{
     "键名1" :值1,
     "键名2" :值2
}
这里的键名是字符串,但是值可以是数值、字符串、对象、数组或逻辑true和false。

从JSON中读数据

jsonObj.key
jsonObj[ "key" ]

向JSON写数据

jsonObj.key = 值;
jsonObj[ "key" ] = 值;

delete   jsonObj.key;

使用for…in…循环来遍历JSON对象中的数据



二、JSON数组结构

JSON数组结构是用中括号“[]”括起来,中括号内部由0个或多个以英文逗号“,”分隔的值列表组成。

语法:

1
2
3
4
5
6
7
8
9
10
11
12
var arr =
[
     {
         "键名1" :值1,
         "键名2" :值2
     },
     {
         "键名3" :值3,
         "键名4" :值4
     },
     ……
]
对于获取、写入、修改、删除、遍历JSON数组结构中的数据,跟JSON对象结构的数据操作类似

CSS3

css3性能 从原理上来说的话
CSS == iOS
JS == Android
CSS3浏览器私有前缀
私有前缀 对应的浏览器
-webkit- chrome和safari
-moz- Firefox
-ms- IE
-o- opera
border-radius: 10px ;
-webkit-border-radius: 10px /*兼容chrome和Safari*/
-moz-border-radius: 10px ;     /*兼容Firefox*/
-ms-border-radius: 10px ;      /*兼容IE*/
-o-border-radius: 10px ;       /*兼容opera*/

有插件



本地存储分为cookie,以及新增的localStorage和sessionStorage


















你可能感兴趣的:(编程语言)