diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58fc4c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Exercise/cs02-imooc/Thumbs.db \ No newline at end of file diff --git a/Exercise/cs01-blog/css/reset.css b/Exercise/cs01-blog/css/reset.css index ca6e8c9..6aa8535 100644 --- a/Exercise/cs01-blog/css/reset.css +++ b/Exercise/cs01-blog/css/reset.css @@ -1,4 +1,5 @@ /* v1.0 | 20080212 */ +/* v1.0 | 20080212 */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, diff --git a/Exercise/cs02-imooc/blog-banner.md b/Exercise/cs02-imooc/blog-banner.md new file mode 100644 index 0000000..29748f6 --- /dev/null +++ b/Exercise/cs02-imooc/blog-banner.md @@ -0,0 +1,103 @@ +##2015-09-20 14:53:23 构建Banner## +###效果图### + + +###构建HTML结构### +```html + + +###构建相应CSS### + +```css +/*banner*/ +.banner{ + width: 100%; + height: 600px; + background: url("../images/banner2.jpg") no-repeat center center; + overflow: hidden; +} +.banner-content{ + width: 1200px; + margin:0 auto; + position: relative; +} + +.inner .more{ + font-size: 14px; + font-weight: bold; + color:#000; + line-height: 14px; + position: absolute; + right:80px; + top:360px; + padding-left: 21px; + background: url("../images/banner_sprite.png") -120px 0 no-repeat; +} +``` +这里将banner的盒子指定600px高度,以显示图片内容,图片实际尺寸(2000x600)超出了显示尺寸(1477x600),为此,采用背景图居中的方式(center,center)加载banner,并对额外部分进行隐藏(overflow:hidden);为使内部链接便于定位,其所在父容器(banner-content)采用相对定位方式,使得所有banner-content的子元素可以采用相对于它的方式进行绝对定位。这里的more链接就采用绝对定位方式,并指定right和top绝对值坐标。此外,链接前需要显示一个链接图标,而且需要和链接保持一致的可点击效果,为实现这一目的,采用padding-left:21px,使得左侧腾出21px的内部边距以显示图标,而图标是由一张banner-sprite雪碧图构成,通过定位坐标值(-120px 0)显示指定的图标。 + +###characters效果图### + +###构建HTML结构### +```html +
+
+
+ 专注IT学习 + 聚焦实战开发 + 课程完全免费 +
+
+
+``` +###构建相应CSS### +```CSS +.characters{ + background-color: #fff; + min-width:1200px; +} +.idx-width{ + width:1200px; + margin: 0 auto; +} +.characters-wrap{ + padding: 50px 120px; + height: 183px; + position: relative; +} +.icon-1,.icon-2,.icon-3{ + position: absolute; + display: block; + top: 50px; + +} +.icon-1{ + background: url("../images/char-icon1.png") no-repeat left top; + width: 135px; + height: 183px; + left: 120px; +} +.icon-2{ + background: url("../images/char-icon2.png") no-repeat left top; + width: 180px; + height: 181px; + left: 50%; + margin-left: -90px; +} +.icon-3{ + background: url("../images/char-icon3.png") no-repeat left top; + width: 166px; + height: 181px; + right: 120px; +} +.hidden-text{ + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} +``` +三个span图标,以绝对定位的方式定位在父容器中,因此父容器设置position:relative;icon-1采用left:120px;而相应的icon-3采用right:120px;居中的icon-2采用left:50%,再向左移动自身宽度一半的方式(margin-left:-90px) \ No newline at end of file diff --git "a/Exercise/cs02-imooc/blog-closure\351\227\255\345\214\205.md" "b/Exercise/cs02-imooc/blog-closure\351\227\255\345\214\205.md" new file mode 100644 index 0000000..472f3d4 --- /dev/null +++ "b/Exercise/cs02-imooc/blog-closure\351\227\255\345\214\205.md" @@ -0,0 +1,23 @@ +## Scala 学习笔记--闭包## + +###引言### +你可以在任何作用域内定义`函数`:包,类甚至是另一个函数或者方法。在函数体内,你可以访问到相应作用域内的任何变量。即使该变量不再处于作用域内时仍能被调用。 + + +###示例### +```scala +def mulBy(factor:Double)=(x:Double)=>factor*x + +val triple = mulBy(3) +val half = mulBy(0.5) +println(triple(14)+" "+half(14))//将打印42 7 +``` +上述代码执行过程是这样的: +* mulBy的首次调用将参数变量factor设为3.该变量在(x:Double)=>factor*x函数的函数体内被引用,该函数被存入triple。然后参数变量factor从运行时的栈上被弹出。 +* 接下来,mulBy再次被调用,这次factor被设为0.5。该变量在(x:Double)=>factor*x函数的函数体内被引用,该函数被存入half。 +每一个返回的函数都有自己的factor设置。 + +>这样一个函数被称之为`闭包(closure)`。闭包由代码和代码用到的任何非局部变量定义构成。这些函数实际上是以类的对象方式实现的,该类有一个实例变量factor和一个包含了函数体的apply方法。 +闭包如何实现并不重要。Scala编译器会确保你的函数可以访问非局部变量。 + +>如果闭包是语言很自然的组成部分,则他们并不会难以理解或让人感到意外。许多现代的语言,比如JavaScript,Ruby和Python都支持闭包。Java是个例外,至少在第7版还不支持。Java8将会支持一种形式上受限的闭包。 diff --git a/Exercise/cs02-imooc/blog-frontend-framework.md b/Exercise/cs02-imooc/blog-frontend-framework.md new file mode 100644 index 0000000..032367f --- /dev/null +++ b/Exercise/cs02-imooc/blog-frontend-framework.md @@ -0,0 +1,74 @@ +##最流行前端开发框架对比评测## +如今,各种开发框架层出不穷,各有千秋。哪些是较受开发者关注的呢?根据Github上的流行程度整理了2014年最受欢迎的6个前端开发框架,并进行对比说明,希望帮助有需要的朋友选择合适自己的前端框架。 +1. **Bootstrap** + + +>Bootstrap毫无疑问是现今框架的领导者。他不仅仅流行,每天用户量也在不断增长。你可以相信,这个工具不会让你失望,你也可以单独使用它制作自己的网页。 + + * 创建者:Mark Otto and Jacob Thornton + * 发布:2011 + * 当前版本:3.3.1 + * 流行度:75,000 stars on GitHub + * 描述:“Bootstrap is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.” + * 核心概念/原理:RWD和 移动优先 + * 框架大小:145 KB + * 预处理器:Less and Sass + * 响应式:Yes + * 模块化:Yes + * 起始模版/轮廓:Yes + * 图标集:Glyphicons + * 其他插件:无绑定,有其他三方插件 + * 独特组件:Jumbotron + * 文档:Good + * 定制:基本 GUI 定制,不过需要手动修改,因为无颜色选取工具。 + * 浏览器支持: Firefox、Chrome、Safari、IE8(IE8需要 Respond.js) + * 授权: MIT + +2.**Foundation by ZURB** + + + +>与Bootstrap相比,Foundation屈居第二,不过这并不能说明它不受欢迎。 ZURB在后面强有力的支持,使得 Foundation 更加强大!Foundation被各大网站使用,如Facebook、Mozilla、Ebay、 Yahoo、美国国家地理网站等等。 + + * 发布:2011 + * 创建者:ZURB + * 当前版本:5.4.7 + * 流行度:18,000 stars on GitHub + * 描述: “The most advanced responsive front-end framework in the world” + * 核心概念/原理:RWD、Mobile First、Semantic + * 框架大小:326 KB + * 预处理器: Sass + * 响应式: Yes + * 模块化: Yes + * 启始模版/布局: Yes + * 图标集:Foundation Icon Fonts + * 其他组件:Yes + * 独特组件:Icon Bar、 Clearing Lightbox、Flex Video、Keystrokes、Joyride、Pricing Tables + * 文档:Good。有许多资源可参考。 + * 定制: 无GUI 定制,但可自己写。 + * 浏览器支持: Chrome、Firefox、Safari、IE9、 iOS、Android、Windows Phone 7 + * 授权:MIT + * 与众不同:对于商务运输、教育培训、咨询等行业来说,Foundation是一个专业框架。它还提供很多资源让你快速学习。 + +3.**Semantic UI** + + +>Semantic UI正在不懈努力让网页制作变得更加Semantic。原生语言规则让代码更易读易懂。 + + * 创建者:Jack Lukic + * 发布:2013 + * 当前版本:1.2.0 + * 流行度:12,900 stars on GitHub + * 描述: “A UI component framework based around useful principles from natural language.” + * 核心概念/原理: Semantic、Tag Ambivalence、Responsive + * 框架大小:552 KB + * 预处理器:Less + * 响应式:Yes + * 模块化:Yes + * 启始模版/布局:No + * 图标集:Font Awesome + * 其他组件:No + * 独特组件:Divider、Flag、Rail、Reveal、Step、Advertisement、Card、Feed、Item、 Statistic、Dimmer、Rating、Shape + * 文档: 非常完善。Semantic 提供多个结构层次的文档,单独网站提供给初学者以及其它定制教程等。 + * 定制:无GUI 定制,但可自己写。 + * 与众不同:Semantic可以说今天所讨论的框架中是最创新、功能最全面的框架。整体构架、命名规则,有清晰 的逻辑、语义性,超过其它框架。 \ No newline at end of file diff --git a/Exercise/cs02-imooc/blog-header.md b/Exercise/cs02-imooc/blog-header.md new file mode 100644 index 0000000..5416ffc --- /dev/null +++ b/Exercise/cs02-imooc/blog-header.md @@ -0,0 +1,111 @@ +## 9/15/2015 8:12:38 PM IMOOC首页构建 ## + +###创建header导航### +>通过本小节的学习,掌握网站logo的常用技巧,深入掌握: +>display,overflow,white-space,text-indent的用法 + +先来看效果图 + +观察可知,导航可由四个部分构成(课程logo,导航菜单条,搜索工具栏,登录窗口) +由此可以实现相关的HTML代码结构,具体如下: +```HTML +
+ + +
+ +
+
+ 慕课APP +
+
+ + +
+
+``` +对照效果图,下面针对该结构,使用CSS样式表实现最终的效果,具体步骤如下: + +1.**重置CSS样式**,在网页文档的``标签位置引入外部reset.css样式链接 + +2.**引入logo** +```css +.logo{ + margin:0 20px; + width: 140px; +} +.logo a{ + display: block; + background: url(../images/logo.png) center center no-repeat; + text-indent: 100%; + overflow: hidden; + white-space: nowrap; + height: 60px; + line-height: 60px; +} +``` +这里根据logo图片大小指定div.logo盒子的大小(140px×60px),同时,指定左右20px的外边距。为了让logo可以点击,里面的a链接必须处理成块状结构(或者inline-block),从而可以通过width和height指定其大小,链接中的文字在效果图中并不需要显示,但这里还是添加了,主要为了出于辅助阅读(盲人阅读器),同时也便于搜索引擎访问。这里为了让文字不可见,通过样式代码text-indent:100%;当然也可以设置为-100%,这样就移出在盒子显示之外,但一旦超出盒子范围的时候,很多浏览器就会自动采用换行的方式进行显示,这里用white-space:nowrap属性禁止文字换行,这样露在盒子外边的链接文字还是不够美观,使用overflow:hidden彻底将其隐藏。最后,这里的图片在定位的时候采用center center的模式,将图片水平和垂直方向上都采用居中显示。 + +3.**制作导航菜单样式** +>导航菜单的制作需要重点掌握链接文字在块状显示中的水平居中,垂直居中的实现技巧。 + +观察效果图,导航菜单和logo处于同一行中,这就需要为logo和导航菜单区块设置浮动效果。此外,无序列表形成的4个菜单,每个菜单60px,所以需要指定hd-nav的宽度为240px;菜单项li采用向左浮动效果,每个链接通过text-align:center样式属性实现水平居中效果,通过指定line-height为60px(与整个nav高度一致),利用元素内容在块状盒中默认采用垂直居中的特点,实现菜单文字的垂直居中显示效果。 + +4.**制作登录区域样式** + +登录区域采用浮动到右侧的样式,而构成其选项的无序列表,其元素采用向左浮动形式,每个选项宽度高度为60x60;这里需要注意的是,为实现QQ头像,不能使用背景图方式,必须使用img标签,并使用border-radius进行圆角处理。为此,要将img标签头像垂直居中,需将其显示属性设置为inline-block,并指定其Vertical-align为middle,而不能采用block形式。 +>延伸阅读:[CSS vertical-align](http://www.zhangxinxu.com/wordpress/2010/05/%E6%88%91%E5%AF%B9css-vertical-align%E7%9A%84%E4%B8%80%E4%BA%9B%E7%90%86%E8%A7%A3%E4%B8%8E%E8%AE%A4%E8%AF%86%EF%BC%88%E4%B8%80%EF%BC%89/) + +最后,修改.hd-nav li a:hover样式选择器为 header li a:hover以适配这里的所有选项菜单链接情况。 + +5.**制作app-down区域和搜索栏** + +**相关CSS** +``` +.r{ + float:right; +} +.l{ + float:left; +} +.app-down{ + width: 87px; + height: 60px; +} +.app-down a{ + display: block; + height: 60px; + color:#656e73; + line-height: 60px; + padding: 0 8px; + font-size: 14px; + white-space: nowrap; +} +.app-down a:hover .app-icon{ + background-position: 0px -16px; +} + +.app-icon{ + background: url("../images/head-app-icon.png") no-repeat top left ; + display: inline-block; + width: 11px; + height: 16px; + vertical-align: -3px; + margin-right: 5px; +} +``` +上述代码中,使用雪碧图head-app-icon.png实现鼠标悬浮效果。即鼠标处于hover时,改变背景图的坐标(background-position)以显示悬停的图片效果。app-down区域的链接a采用block块状显示,使用line-height:60px致使其中的文字处于垂直居中,使用padding-left,以腾出左侧图标显示区域,marin-right:5px用于控制图标和文字的显示间隔。Vertical-align用于图标控制垂直的位置。 + +需要额外说明的是,为了更灵活地控制左右浮动效果,采用了自定义类`l和r`,在应用时使用类样式的叠加。 + +在处理文本框时,去除文本框自带的边框效果,并使用自定义背景色和前景色。指定padding和line-height;并为文本框获取焦点时设置相应的背景效果。 \ No newline at end of file diff --git a/Exercise/cs02-imooc/blog-intro.files/colorschememapping.xml b/Exercise/cs02-imooc/blog-intro.files/colorschememapping.xml new file mode 100644 index 0000000..6a0069c --- /dev/null +++ b/Exercise/cs02-imooc/blog-intro.files/colorschememapping.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Exercise/cs02-imooc/blog-intro.files/filelist.xml b/Exercise/cs02-imooc/blog-intro.files/filelist.xml new file mode 100644 index 0000000..98f82ff --- /dev/null +++ b/Exercise/cs02-imooc/blog-intro.files/filelist.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Exercise/cs02-imooc/blog-intro.files/header.html b/Exercise/cs02-imooc/blog-intro.files/header.html new file mode 100644 index 0000000..2e5fe67 Binary files /dev/null and b/Exercise/cs02-imooc/blog-intro.files/header.html differ diff --git a/Exercise/cs02-imooc/blog-intro.files/themedata.thmx b/Exercise/cs02-imooc/blog-intro.files/themedata.thmx new file mode 100644 index 0000000..3508e1d Binary files /dev/null and b/Exercise/cs02-imooc/blog-intro.files/themedata.thmx differ diff --git a/Exercise/cs02-imooc/blog-intro.html b/Exercise/cs02-imooc/blog-intro.html new file mode 100644 index 0000000..3f3ac75 --- /dev/null +++ b/Exercise/cs02-imooc/blog-intro.html @@ -0,0 +1,889 @@ +blog-intro

+Building intro blocks

+ +

+效果图

+ +

+ +

+构建HTML结构

+ +
    <div class="intros">
+        <div class="intro bg-grey ">
+            <div class="idx-width intro1-wrap">
+                <div class="intro1-star"></div>
+                <div class="intro1-video"></div>
+                <div class="intro1-text hidden-text">精心制作的视频课程。老师都技术大牛实战派。课程内容接地气,实际工作用得着。</div>
+            </div>
+        </div>
+        ……
+    </div>
+ +

注意:intro特性介绍分成四个部分,每个部分交叉的显示灰色/白色背景,文字图背景位置交叉地以右侧/左侧的形式进行定位。制作方法类似,这里仅以第一个特性介绍为例,它由星星(Star),视频(Video)和右侧文字三个部分构成,因此,在构建HTML结构时放置了三个div区域。外层的idx-width用于控制整个外盒的尺寸和居中显示效果。bg-grey显示背景色效果。

+ +

+构建相应CSS

+ +
.hidden-text{
+    text-indent: 100%;
+    white-space: nowrap;
+    overflow: hidden;
+}
+
+.bg-grey{
+    background-color: #eef1f2;
+}
+.bg-white{
+    background-color: #fff;
+}
+.intro1-wrap{
+    height: 400px;
+    position: relative;
+}
+.intro1-star{
+    position: absolute;
+    left: -15px;
+    top: -20px;
+    background: url("../images/01-star.png") no-repeat top left;
+    width: 581px;
+    height: 431px;
+    z-index: 10;
+}
+.intro1-video{
+    position: absolute;
+    width: 581px;
+    height: 431px;
+    background: url("../images/01-video.png") 0 0 no-repeat;
+    left: -15px;
+    bottom: 0px;
+    z-index: 5;
+}
+.intro1-text{
+    position: absolute;
+    width: 493px;
+    height: 70px;
+    right: 105px;
+    top: 164px;
+    background: url("../images/01-text.png") 0 0 no-repeat;
+}
+ +

整个背景采用纯灰色和白色交替形式,为方便,将灰色和白色背景分别定义bg-greybg-white类,有了他们,在需要相应背景的元素开始标签添加相应的类样式进行叠加即可。为便于搜索引擎搜索,元素提供了图片文字对应的文字版本,但这些文字不需要用户看到,这里使用.hidden-text样式来隐藏这些图片文字。 +intro2~4的实现方式与此类似,在此不再赘述,下面给出完整CSS代码

+ +
.intro2-wrap{
+    height: 400px;
+    position: relative;
+}
+.intro2-text{
+    width: 512px;
+    height: 70px;
+    position: absolute;
+    left: 105px;
+    top: 165px;
+    background:  url("../images/02-text.png") 0 0 no-repeat;
+}
+.intro2-computer{
+    background:  url("../images/02-computer2.png") 0 0 no-repeat;
+    position: absolute;
+    top: -30px;
+    width: 580px;
+    height: 430px;
+    right: 0;
+}
+
+.intro3-wrap{
+    height: 400px;
+    position: relative;
+}
+.intro3-calendar{
+    background:  url("../images/03-calendar.png") 0 0 no-repeat;
+    position: absolute;
+    left: 0px;
+    top:-31px;
+    width: 581px;
+    height: 431px;
+    z-index: 1;
+}
+.intro3-text{
+    position: absolute;
+    right:165px ;
+    width: 476px;
+    height: 70px;
+    top: 165px;
+    background:  url("../images/03-text.png") 0 0 no-repeat;
+}
+.intro3-smoke{
+    background:  url("../images/03-smoke.png") 0 0 no-repeat;
+    position: absolute;
+    left: 0px;
+    top: -31px;
+    width: 581px;
+    height: 431px;
+    z-index:2 ;
+}
+.intro3-rockets{
+    background:  url("../images/03-rockets.png") 0 0 no-repeat;
+    position: absolute;
+    left: 0px;
+    top: -46px;
+    width: 581px;
+    height: 431px;
+    z-index:3 ;
+}
+
+.intro4-wrap{
+    height: 400px;
+    position: relative;
+}
+.intro4-text{
+    background: url("../images/04-text.png") 0 0 no-repeat;
+    height: 70px;
+    width: 422px;
+    position: absolute;
+    left: 146px;
+    top: 165px;
+    z-index: 1;
+}
+.intro4-hand{
+    background:  url("../images/04-hand.png") 0 0 no-repeat;
+    height: 430px;
+    width: 581px;
+    right: 0;
+    top: -30px;
+    position: absolute;
+    z-index: 5;
+}
+.intro4-icon{
+    background: url("../images/04-icon.png") 0 0 no-repeat;
+    height: 430px;
+    width: 581px;
+    right: 0;
+    top: -30px;
+    position: absolute;
+    z-index: 10;
+}
+
\ No newline at end of file diff --git a/Exercise/cs02-imooc/blog-intro.md b/Exercise/cs02-imooc/blog-intro.md new file mode 100644 index 0000000..9e36176 --- /dev/null +++ b/Exercise/cs02-imooc/blog-intro.md @@ -0,0 +1,159 @@ +## Building intro blocks## +###效果图### + + +###构建HTML结构### +```html +
+
+
+
+
+
精心制作的视频课程。老师都技术大牛实战派。课程内容接地气,实际工作用得着。
+
+
+ …… +
+``` +**注意:**intro特性介绍分成四个部分,每个部分交叉的显示灰色/白色背景,文字图背景位置交叉地以右侧/左侧的形式进行定位。制作方法类似,这里仅以第一个特性介绍为例,它由星星(Star),视频(Video)和右侧文字三个部分构成,因此,在构建HTML结构时放置了三个div区域。外层的idx-width用于控制整个外盒的尺寸和居中显示效果。bg-grey显示背景色效果。 +###构建相应CSS### +```css +.hidden-text{ + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} + +.bg-grey{ + background-color: #eef1f2; +} +.bg-white{ + background-color: #fff; +} +.intro1-wrap{ + height: 400px; + position: relative; +} +.intro1-star{ + position: absolute; + left: -15px; + top: -20px; + background: url("../images/01-star.png") no-repeat top left; + width: 581px; + height: 431px; + z-index: 10; +} +.intro1-video{ + position: absolute; + width: 581px; + height: 431px; + background: url("../images/01-video.png") 0 0 no-repeat; + left: -15px; + bottom: 0px; + z-index: 5; +} +.intro1-text{ + position: absolute; + width: 493px; + height: 70px; + right: 105px; + top: 164px; + background: url("../images/01-text.png") 0 0 no-repeat; +} +``` +整个背景采用纯灰色和白色交替形式,为方便,将灰色和白色背景分别定义`bg-grey`和`bg-white`类,有了他们,在需要相应背景的元素开始标签添加相应的类样式进行叠加即可。为便于搜索引擎搜索,元素提供了图片文字对应的文字版本,但这些文字不需要用户看到,这里使用`.hidden-text`样式来隐藏这些图片文字。 +intro2~4的实现方式与此类似,在此不再赘述,下面给出完整CSS代码 +```css +.intro2-wrap{ + height: 400px; + position: relative; +} +.intro2-text{ + width: 512px; + height: 70px; + position: absolute; + left: 105px; + top: 165px; + background: url("../images/02-text.png") 0 0 no-repeat; +} +.intro2-computer{ + background: url("../images/02-computer2.png") 0 0 no-repeat; + position: absolute; + top: -30px; + width: 580px; + height: 430px; + right: 0; +} + +.intro3-wrap{ + height: 400px; + position: relative; +} +.intro3-calendar{ + background: url("../images/03-calendar.png") 0 0 no-repeat; + position: absolute; + left: 0px; + top:-31px; + width: 581px; + height: 431px; + z-index: 1; +} +.intro3-text{ + position: absolute; + right:165px ; + width: 476px; + height: 70px; + top: 165px; + background: url("../images/03-text.png") 0 0 no-repeat; +} +.intro3-smoke{ + background: url("../images/03-smoke.png") 0 0 no-repeat; + position: absolute; + left: 0px; + top: -31px; + width: 581px; + height: 431px; + z-index:2 ; +} +.intro3-rockets{ + background: url("../images/03-rockets.png") 0 0 no-repeat; + position: absolute; + left: 0px; + top: -46px; + width: 581px; + height: 431px; + z-index:3 ; +} + +.intro4-wrap{ + height: 400px; + position: relative; +} +.intro4-text{ + background: url("../images/04-text.png") 0 0 no-repeat; + height: 70px; + width: 422px; + position: absolute; + left: 146px; + top: 165px; + z-index: 1; +} +.intro4-hand{ + background: url("../images/04-hand.png") 0 0 no-repeat; + height: 430px; + width: 581px; + right: 0; + top: -30px; + position: absolute; + z-index: 5; +} +.intro4-icon{ + background: url("../images/04-icon.png") 0 0 no-repeat; + height: 430px; + width: 581px; + right: 0; + top: -30px; + position: absolute; + z-index: 10; +} +``` \ No newline at end of file diff --git a/Exercise/cs02-imooc/blog-scala-1.md b/Exercise/cs02-imooc/blog-scala-1.md new file mode 100644 index 0000000..44380b9 --- /dev/null +++ b/Exercise/cs02-imooc/blog-scala-1.md @@ -0,0 +1,51 @@ +## Scala 学习笔记--基础## + +###基本语法### +Scala有Byte,Char,Short,Int,Long,Float,Double和Boolean八种类型。但都是类,没有基本数据类型。 + +**1、算术和操作符重载** +>a 方法 b 是 a.方法(b)的一种简写 +1 to 10 同1.to(10),将产生1到10的Range类数。 + +scala没有提供++/--操作符,因为Int类是不可变的,这样一个方法不能改变某个整数类型的值。Scala设计者认为不值得为少按一个键额外增加一个特例。 + +对于BigInt +```scala +val x:BigInt = 1234567890 +x*x*x//将产生1881676371789154860897069000 +``` +**2、调用函数和方法** +scala没有提供静态方法,但可以直接使用数学函数,只要import scala.math._ +>在使用以scala.开头的包时,我们可以省去scala前缀。import math._等同于import scala.math._ +scala提供了单例对象,通常一个类对应有一个伴生对象(companion object),其方法跟Java静态方法一样。形式上也是采用`类名.方法名`的形式。 + +**3、apply方法** +"Hello"(4) //将输出'o' +其实现原理是,在背后存在一个名为apply的方法 +def apply(n:Int):Char +也就是说,"Hello"(4)是如下语句的简写 "Hello".apply(4) +同样的例子还有BigInt("1234567890") 其实是BigInt.apply("1234567890")的一种简写;Array(1,4,9,16)返回一数组,其实用的就是伴生对象的apply方法。 +>在调用scala方法的时候,如果该方法不带任何参数,则可以不使用圆括号如"Hello".distinct,一般来讲,没有参数且不改变当前对象的方法不带圆括号。 + +**4、Any和Unit** +在Scala中,每个表达式都应该有某种值,如果在if/else表达式中返回不同的数据类型,则表达式if/else返回的是其公共的父类Any。如果else部分缺失了,那么有可能if语句没有返回值,这时候整个表达式的值可以使用Unit类,写作(),这是Scala中引入的类。 +>也就是说,不带else的if语句等同于如下的写法 +```scala +if(x>0) 1 else () +``` +这里的()可以表示"无有用值"的占位符。当成java和c++中的void + +**5、语句终止** +如果单行中要写下多条语句,则需要以分号分隔。 +如果在写较长语句需要用两行来写的话,需要确保第一行以一个不能用作语句结尾的符号结尾。通常可以选择操作符作为结尾。scala程序员更倾向使用Kernighan&Ritchie风格的花括号: +```java +if(n>0){ + r = r*n + n-=1 +} +``` +**6、块表达式** +块中最后一个表达式的值是块的值,这个特性对某个val的初始化需要多步完成的情况很有用 +val distance = {val dx = x-x0;val dy = y-y0;sqrt(dx*dx+dy*dy)} +一个赋值语句是没有值的,或者说,他们的值是Unit类型。也正是由于这个原因,不要将赋值语句串联起来 +x=y=1 这里y=1的值是(),然后将赋值语句的Unit赋值给x. \ No newline at end of file diff --git a/Exercise/cs02-imooc/blog-scala-2.md b/Exercise/cs02-imooc/blog-scala-2.md new file mode 100644 index 0000000..dff2a71 --- /dev/null +++ b/Exercise/cs02-imooc/blog-scala-2.md @@ -0,0 +1,50 @@ +## Scala 学习笔记--闭包## + +###常见错误### +"-3+4".collect{case '+'=>1;case '-'=> -1} +>注意:collect方法用于`偏函数(partial function)`,那些没有对所有可能的输入值进行定义的函数(例如这里的case),它产出被定义的所有参数的函数值的集合。这里书写时,需要注意case 对偶值=>后的-1之间必须保持一个空格。 + +###`#::`语法### +`#::`操作符很像列表的`::`操作符,只不过他用来构建一个流 + +###match表达式### +```scala +var sign =... +val ch:Char=... + +ch match{ + case '+' => sign = 1 + case '-' => sign = -1 + case _ => sign = 0 +} + +``` +由于match是表达式,也可以写成 +```scala +sign = ch match{ + case '+' => 1 + case '-' => -1 + case _ => 0 +} +``` +您还可以在模式中添加变量 +``` +str(i) match{ + case ch if Character.isDigit(ch)=>digit = Character.digit(ch,10) + ... +} +``` +>Scala的常量通常都是大写字母开头,如果你有一个小写字母开头的常量,则需要将它包在反引号中: + +```scala +import java.io.File._ +str match{ + case `pathSeparator` =>... + ... +} +``` +###提取器### +>`提取器extractor`,带有从对象中提取值的unapply或unapplySeq方法的对象。unapply方法用于提取固定数量的对象,而unapplySeq提取的是一个序列,可长可短。 +* Array伴生对象就是一个提取器 +* 正则表达式是另一个适合提取器的场景 + diff --git a/Exercise/cs02-imooc/css/reset.css b/Exercise/cs02-imooc/css/reset.css new file mode 100644 index 0000000..ca6e8c9 --- /dev/null +++ b/Exercise/cs02-imooc/css/reset.css @@ -0,0 +1,52 @@ +/* v1.0 | 20080212 */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; + vertical-align: baseline; + background: transparent; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} + +/* remember to define focus styles! */ +:focus { + outline: 0; +} + +/* remember to highlight inserts somehow! */ +ins { + text-decoration: none; +} +del { + text-decoration: line-through; +} + +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/Exercise/cs02-imooc/css/style.css b/Exercise/cs02-imooc/css/style.css new file mode 100644 index 0000000..f0ee7ac --- /dev/null +++ b/Exercise/cs02-imooc/css/style.css @@ -0,0 +1,351 @@ +@charset "utf-8"; +body{ + font-family: "Helvetica Neue","Hiragino Sans GB","Segoe UI","Microsoft Yahei","微软雅黑",Tahoma,Arial,STHeiti,sans-serif; +} +a{ + text-decoration: none; +} +header{ + height: 60px; + background-color: #000; +} +.logo{ + margin:0 20px; + width: 140px; + float: left; +} +.logo a{ + display: block; + background: url(../images/logo.png) center center no-repeat; + text-indent: 100%; + overflow: hidden; + white-space: nowrap; + height: 60px; + line-height: 60px; +} +.hd-nav{ + width: 240px; + float: left; +} +.hd-nav li{ + width:60px; + float: left; +} +.hd-nav li a{ + color:#787d82; + font-size: 14px; + display: block; + line-height: 60px; + text-align: center; +} +header li a:hover,.app-down a:hover{ + background-color: #363c41; + color:#fff; +} + +.login-area{ + float: right; + margin-right: 20px; +} +.login-area ul li{ + float: left; + +} +.login-area ul li a{ + display: block; + width: 60px; + height: 60px; + line-height: 60px; + text-align: center; +} +.my_message a{ + background: url(../images/icon_msg.png) no-repeat center center; +} +.user_card a{ +} +.user_card img{ + /*display: block;*/ + display: inline-block; + border-radius: 22px; + width: 28px; + height: 28px; + /*line-height: 60px;*/ + vertical-align: middle; +} + +.r{ + float:right; +} +.l{ + float:left; +} +.app-down{ + width: 87px; + height: 60px; +} +.app-down a{ + display: block; + height: 60px; + color:#656e73; + line-height: 60px; + padding: 0 8px; + font-size: 14px; + white-space: nowrap; +} +.app-down a:hover .app-icon{ + background-position: 0px -16px; +} + +.app-icon{ + background: url("../images/head-app-icon.png") no-repeat top left ; + display: inline-block; + width: 11px; + height: 16px; + vertical-align: -3px; + margin-right: 5px; + /*-webkit-transition-property: all 0.3s ease 0s; + -moz-transition-property: all 0.3s ease 0s; + -ms-transition-property: all 0.3s ease 0s; + -o-transition-property: all 0.3s ease 0s; + transition-property: all 0.3s ease 0s;*/ + +} + +.search-area{ + width: 240px; + height: 30px; + background-color: #363c41 ; + margin: 15px 20px 15px 0; +} +.search-input{ + background-color: #363c41; + border:none; + color: #14191e; + height: 20px; + line-height: 20px; + padding: 5px 10px; + width: 190px; + float: left; +} +.search-input:hover{ + background-color: #fff; + color:#363d40; +} +.btn-search{ + float: right; + width: 30px; + height: 30px; + background: url("../images/gsearch-sprite.png") no-repeat top left; + background-color: rgb(0,0,0,0); + border:none; +} + +.clearfix::after{ + clear: both; + content: " "; + display: block; + height: 0; + visibility: hidden; +} + + +/*banner*/ +.banner{ + width: 100%; + height: 600px; + background: url("../images/banner2.jpg") no-repeat center center; + overflow: hidden; +} +.banner-content{ + width: 1200px; + margin:0 auto; + background-color: #ccc; + position: relative; +} + +.inner .more{ + font-size: 14px; + font-weight: bold; + color:#000; + line-height: 14px; + position: absolute; + right:80px; + top:360px; + padding-left: 21px; + background: url("../images/banner_sprite.png") -120px 0 no-repeat; +} + +.characters{ + background-color: #fff; + min-width:1200px; +} +.idx-width{ + width:1200px; + margin: 0 auto; +} +.characters-wrap{ + padding: 50px 120px; + height: 183px; + position: relative; +} +.icon-1,.icon-2,.icon-3{ + position: absolute; + display: block; + top: 50px; + +} +.icon-1{ + background: url("../images/char-icon1.png") no-repeat left top; + width: 135px; + height: 183px; + left: 120px; +} +.icon-2{ + background: url("../images/char-icon2.png") no-repeat left top; + width: 180px; + height: 181px; + left: 50%; + margin-left: -90px; +} +.icon-3{ + background: url("../images/char-icon3.png") no-repeat left top; + width: 166px; + height: 181px; + right: 120px; +} +.hidden-text{ + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} + +.bg-grey{ + background-color: #eef1f2; +} +.bg-white{ + background-color: #fff; +} +.intro1-wrap{ + height: 400px; + position: relative; +} +.intro1-star{ + position: absolute; + left: -15px; + top: -20px; + background: url("../images/01-star.png") no-repeat top left; + width: 581px; + height: 431px; + z-index: 10; +} +.intro1-video{ + position: absolute; + width: 581px; + height: 431px; + background: url("../images/01-video.png") 0 0 no-repeat; + left: -15px; + bottom: 0px; + z-index: 5; +} +.intro1-text{ + position: absolute; + width: 493px; + height: 70px; + right: 105px; + top: 164px; + background: url("../images/01-text.png") 0 0 no-repeat; + +} + +.intro2-wrap{ + height: 400px; + position: relative; +} +.intro2-text{ + width: 512px; + height: 70px; + position: absolute; + left: 105px; + top: 165px; + background: url("../images/02-text.png") 0 0 no-repeat; +} +.intro2-computer{ + background: url("../images/02-computer2.png") 0 0 no-repeat; + position: absolute; + top: -30px; + width: 580px; + height: 430px; + right: 0; +} + +.intro3-wrap{ + height: 400px; + position: relative; +} +.intro3-calendar{ + background: url("../images/03-calendar.png") 0 0 no-repeat; + position: absolute; + left: 0px; + top:-31px; + width: 581px; + height: 431px; + z-index: 1; +} +.intro3-text{ + position: absolute; + right:165px ; + width: 476px; + height: 70px; + top: 165px; + background: url("../images/03-text.png") 0 0 no-repeat; +} +.intro3-smoke{ + background: url("../images/03-smoke.png") 0 0 no-repeat; + position: absolute; + left: 0px; + top: -31px; + width: 581px; + height: 431px; + z-index:2 ; +} +.intro3-rockets{ + background: url("../images/03-rockets.png") 0 0 no-repeat; + position: absolute; + left: 0px; + top: -46px; + width: 581px; + height: 431px; + z-index:3 ; +} + +.intro4-wrap{ + height: 400px; + position: relative; +} +.intro4-text{ + background: url("../images/04-text.png") 0 0 no-repeat; + height: 70px; + width: 422px; + position: absolute; + left: 146px; + top: 165px; + z-index: 1; +} +.intro4-hand{ + background: url("../images/04-hand.png") 0 0 no-repeat; + height: 430px; + width: 581px; + right: 0; + top: -30px; + position: absolute; + z-index: 5; +} +.intro4-icon{ + background: url("../images/04-icon.png") 0 0 no-repeat; + height: 430px; + width: 581px; + right: 0; + top: -30px; + position: absolute; + z-index: 10; +} \ No newline at end of file diff --git a/Exercise/cs02-imooc/ex-vertical-align.html b/Exercise/cs02-imooc/ex-vertical-align.html new file mode 100644 index 0000000..a4922eb --- /dev/null +++ b/Exercise/cs02-imooc/ex-vertical-align.html @@ -0,0 +1,30 @@ + + + + + vertical-align Demo + + + +
+
+ +
+
+ + \ No newline at end of file diff --git a/Exercise/cs02-imooc/images/01-star.png b/Exercise/cs02-imooc/images/01-star.png new file mode 100644 index 0000000..1b63eb8 Binary files /dev/null and b/Exercise/cs02-imooc/images/01-star.png differ diff --git a/Exercise/cs02-imooc/images/01-text.png b/Exercise/cs02-imooc/images/01-text.png new file mode 100644 index 0000000..6e7a75c Binary files /dev/null and b/Exercise/cs02-imooc/images/01-text.png differ diff --git a/Exercise/cs02-imooc/images/01-video.png b/Exercise/cs02-imooc/images/01-video.png new file mode 100644 index 0000000..fa6307b Binary files /dev/null and b/Exercise/cs02-imooc/images/01-video.png differ diff --git a/Exercise/cs02-imooc/images/02-computer1.png b/Exercise/cs02-imooc/images/02-computer1.png new file mode 100644 index 0000000..0fa056f Binary files /dev/null and b/Exercise/cs02-imooc/images/02-computer1.png differ diff --git a/Exercise/cs02-imooc/images/02-computer2.png b/Exercise/cs02-imooc/images/02-computer2.png new file mode 100644 index 0000000..ed64621 Binary files /dev/null and b/Exercise/cs02-imooc/images/02-computer2.png differ diff --git a/Exercise/cs02-imooc/images/02-text.png b/Exercise/cs02-imooc/images/02-text.png new file mode 100644 index 0000000..794ee0b Binary files /dev/null and b/Exercise/cs02-imooc/images/02-text.png differ diff --git a/Exercise/cs02-imooc/images/03-calendar.png b/Exercise/cs02-imooc/images/03-calendar.png new file mode 100644 index 0000000..e964417 Binary files /dev/null and b/Exercise/cs02-imooc/images/03-calendar.png differ diff --git a/Exercise/cs02-imooc/images/03-rockets.png b/Exercise/cs02-imooc/images/03-rockets.png new file mode 100644 index 0000000..9e510be Binary files /dev/null and b/Exercise/cs02-imooc/images/03-rockets.png differ diff --git a/Exercise/cs02-imooc/images/03-smoke.png b/Exercise/cs02-imooc/images/03-smoke.png new file mode 100644 index 0000000..470c940 Binary files /dev/null and b/Exercise/cs02-imooc/images/03-smoke.png differ diff --git a/Exercise/cs02-imooc/images/03-text.png b/Exercise/cs02-imooc/images/03-text.png new file mode 100644 index 0000000..9fb95c8 Binary files /dev/null and b/Exercise/cs02-imooc/images/03-text.png differ diff --git a/Exercise/cs02-imooc/images/04-hand.png b/Exercise/cs02-imooc/images/04-hand.png new file mode 100644 index 0000000..ae2c3da Binary files /dev/null and b/Exercise/cs02-imooc/images/04-hand.png differ diff --git a/Exercise/cs02-imooc/images/04-icon.png b/Exercise/cs02-imooc/images/04-icon.png new file mode 100644 index 0000000..3336f1c Binary files /dev/null and b/Exercise/cs02-imooc/images/04-icon.png differ diff --git a/Exercise/cs02-imooc/images/04-text.png b/Exercise/cs02-imooc/images/04-text.png new file mode 100644 index 0000000..27bac87 Binary files /dev/null and b/Exercise/cs02-imooc/images/04-text.png differ diff --git a/Exercise/cs02-imooc/images/Thumbs.db b/Exercise/cs02-imooc/images/Thumbs.db new file mode 100644 index 0000000..179c9cd Binary files /dev/null and b/Exercise/cs02-imooc/images/Thumbs.db differ diff --git a/Exercise/cs02-imooc/images/banner2.jpg b/Exercise/cs02-imooc/images/banner2.jpg new file mode 100644 index 0000000..98e91af Binary files /dev/null and b/Exercise/cs02-imooc/images/banner2.jpg differ diff --git a/Exercise/cs02-imooc/images/banner_sprite.png b/Exercise/cs02-imooc/images/banner_sprite.png new file mode 100644 index 0000000..e87bd32 Binary files /dev/null and b/Exercise/cs02-imooc/images/banner_sprite.png differ diff --git a/Exercise/cs02-imooc/images/char-icon1.png b/Exercise/cs02-imooc/images/char-icon1.png new file mode 100644 index 0000000..97238b8 Binary files /dev/null and b/Exercise/cs02-imooc/images/char-icon1.png differ diff --git a/Exercise/cs02-imooc/images/char-icon2.png b/Exercise/cs02-imooc/images/char-icon2.png new file mode 100644 index 0000000..b980f8d Binary files /dev/null and b/Exercise/cs02-imooc/images/char-icon2.png differ diff --git a/Exercise/cs02-imooc/images/char-icon3.png b/Exercise/cs02-imooc/images/char-icon3.png new file mode 100644 index 0000000..4aea19d Binary files /dev/null and b/Exercise/cs02-imooc/images/char-icon3.png differ diff --git a/Exercise/cs02-imooc/images/family-bg2.png b/Exercise/cs02-imooc/images/family-bg2.png new file mode 100644 index 0000000..a14e202 Binary files /dev/null and b/Exercise/cs02-imooc/images/family-bg2.png differ diff --git a/Exercise/cs02-imooc/images/gsearch-sprite.png b/Exercise/cs02-imooc/images/gsearch-sprite.png new file mode 100644 index 0000000..c87c8ad Binary files /dev/null and b/Exercise/cs02-imooc/images/gsearch-sprite.png differ diff --git a/Exercise/cs02-imooc/images/head-app-icon.png b/Exercise/cs02-imooc/images/head-app-icon.png new file mode 100644 index 0000000..d0929de Binary files /dev/null and b/Exercise/cs02-imooc/images/head-app-icon.png differ diff --git a/Exercise/cs02-imooc/images/icon_msg.png b/Exercise/cs02-imooc/images/icon_msg.png new file mode 100644 index 0000000..b29e1ea Binary files /dev/null and b/Exercise/cs02-imooc/images/icon_msg.png differ diff --git a/Exercise/cs02-imooc/images/logo.png b/Exercise/cs02-imooc/images/logo.png new file mode 100644 index 0000000..7573dc0 Binary files /dev/null and b/Exercise/cs02-imooc/images/logo.png differ diff --git a/Exercise/cs02-imooc/images/qq40x40.jpg b/Exercise/cs02-imooc/images/qq40x40.jpg new file mode 100644 index 0000000..a022ba0 Binary files /dev/null and b/Exercise/cs02-imooc/images/qq40x40.jpg differ diff --git a/Exercise/cs02-imooc/images/sn-01.png b/Exercise/cs02-imooc/images/sn-01.png new file mode 100644 index 0000000..6b11607 Binary files /dev/null and b/Exercise/cs02-imooc/images/sn-01.png differ diff --git a/Exercise/cs02-imooc/images/user_card_top.png b/Exercise/cs02-imooc/images/user_card_top.png new file mode 100644 index 0000000..24aa93c Binary files /dev/null and b/Exercise/cs02-imooc/images/user_card_top.png differ diff --git "a/Exercise/cs02-imooc/imooc\346\225\210\346\236\234\345\233\276.png" "b/Exercise/cs02-imooc/imooc\346\225\210\346\236\234\345\233\276.png" new file mode 100644 index 0000000..0b188b6 Binary files /dev/null and "b/Exercise/cs02-imooc/imooc\346\225\210\346\236\234\345\233\276.png" differ diff --git a/Exercise/cs02-imooc/index.html b/Exercise/cs02-imooc/index.html new file mode 100644 index 0000000..9984f15 --- /dev/null +++ b/Exercise/cs02-imooc/index.html @@ -0,0 +1,85 @@ + + + + + + imooc + + + + +
+ + + + +
+ + +
+ +
+ + +
+
+
+ 专注IT学习 + 聚焦实战开发 + 课程完全免费 +
+
+
+ +
+
+
+
+
+
精心制作的视频课程。老师都技术大牛实战派。课程内容接地气,实际工作用得着。
+
+
+
+
+
实时交互的在线编程,无需配置任何编程环境,直接就能在线学习编程。省时省力省心。
+
+
+
+
+
+
+
+
+
循序渐近的学习计划,专治各种学习编程迷茫症。有目标有路径,一切尽在掌握中。
+
+
+
+
+
互帮互助的问答社区,有问有答有分享。老师学员同交流,高手小白共进步。
+
+
+
+
+
+ + \ No newline at end of file diff --git a/Exercise/css sprite/images/Thumbs.db b/Exercise/css sprite/images/Thumbs.db new file mode 100644 index 0000000..f17d3c0 Binary files /dev/null and b/Exercise/css sprite/images/Thumbs.db differ diff --git a/images/Thumbs.db b/images/Thumbs.db index 2290a6b..91f0f4a 100644 Binary files a/images/Thumbs.db and b/images/Thumbs.db differ