├── .gitattributes ├── LICENSE.txt ├── README.md ├── bootstrap ├── bootstrap-css.md ├── components.md ├── getting-started.md ├── javascript.md ├── less.md ├── viewgrid.jpg └── writing-responsive-web-design.md ├── css-basics ├── 01.png ├── 02.png ├── 03.png ├── block-and-inline-element.md ├── box-model.md ├── css-grammar.md ├── css-introduce.md ├── css-pseudo-class.md ├── css-selector.md ├── display-and-hidden.md ├── float.md ├── how-use-css.md ├── overflow-attribute.md └── position.md ├── ecmascript-5 ├── 01.png ├── 02.png ├── 03.png ├── 04.png ├── 05.png ├── 06.png ├── 07.png ├── 08.png ├── 09.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.png ├── 16.png ├── 17.png ├── 18.png ├── 19.png ├── 20.png ├── 21.png ├── 22.png ├── 23.png ├── 24.png ├── array.md ├── basics-grammar.md ├── closer.md ├── data-type.md ├── function-object.md ├── function.md ├── inherit.md ├── javascript-introduce.md ├── json.md ├── object.md ├── operator.md ├── prototype.md ├── reference-type.md ├── regular-expression.md ├── scope.md ├── special-function.md ├── statement.md ├── string.md └── variables-and-constants.md ├── html5-basics ├── first-html.md ├── html-basics-element.md ├── html-form.md ├── html-introduce.md ├── html-list.md ├── html-table.md ├── image-element.md └── link-element.md ├── html5 ├── 01.png ├── 02.png ├── 03.jpg ├── 04.jpg ├── 05.jpg ├── 06.jpg ├── 07.png ├── 08.jpg ├── 09.png ├── 10.jpg ├── 11.jpg ├── 12.gif ├── baidu-map.md ├── canvas.md ├── drag-and-drop.md ├── html5-form.md ├── html5-introduce.md ├── html5-svg.md ├── video-and-audio.md ├── web-sockets.md ├── web-storage.md └── web-workers.md └── jquery ├── getting-started.md ├── jquery-animation.md ├── jquery-dom.md ├── jquery-event.md ├── jquery-plugin.md ├── jquery-selector.md ├── jquery-ui.md └── like-array-object.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.md linguist-language=JavaScript 2 | *.png linguist-language=JavaScript -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 目录 2 | 3 | ### HTML5 基础 4 | 5 | - [HTML 介绍](html5-basics/html-introduce.md) 6 | - [第一个 HTML 页面](html5-basics/first-html.md) 7 | - [HTML 基本元素](html5-basics/html-basics-element.md) 8 | - [HTML 列表](html5-basics/html-list.md) 9 | - [链接元素](html5-basics/link-element.md) 10 | - [图片元素](html5-basics/image-element.md) 11 | - [HTML 表格](html5-basics/html-table.md) 12 | - [HTML 表单](html5-basics/html-form.md) 13 | 14 | ### HTML5 新特性 15 | 16 | - [HTML5 介绍](html5/html5-introduce.md) 17 | - [HTML5 表单](html5/html5-form.md) 18 | - [音视频处理](html5/video-and-audio.md) 19 | - [Canvas 画布](html5/canvas.md) 20 | - [HTML5 SVG](html5/html5-svg.md) 21 | - [百度地图](html5/baidu-map.md) 22 | - [HTML5 拖放](html5/drag-and-drop.md) 23 | - [Web Workers](html5/web-workers.md) 24 | - [Web 存储](html5/web-storage.md) 25 | - [Web Sockets](html5/web-sockets.md) 26 | 27 | ### CSS 基础 28 | 29 | - [CSS 介绍](css-basics/css-introduce.md) 30 | - [如何使用 CSS](css-basics/how-use-css.md) 31 | - [CSS 语法](css-basics/css-grammar.md) 32 | - [块级元素与内联元素](css-basics/block-and-inline-element.md) 33 | - [CSS 选择器](css-basics/css-selector.md) 34 | - [CSS 伪类](css-basics/css-pseudo-class.md) 35 | - [盒子模型](css-basics/box-model.md) 36 | - [显示与隐藏](css-basics/display-and-hidden.md) 37 | - [overflow 属性](css-basics/overflow-attribute.md) 38 | - [浮动](css-basics/float.md) 39 | - [定位](css-basics/position.md) 40 | 41 | ### ECMAScript 5 42 | 43 | - [JavaScript 介绍](ecmascript-5/javascript-introduce.md) 44 | - [基础语法](ecmascript-5/basics-grammar.md) 45 | - [变量与常量](ecmascript-5/variables-and-constants.md) 46 | - [数据类型](ecmascript-5/data-type.md) 47 | - [运算符](ecmascript-5/operator.md) 48 | - [语句](ecmascript-5/statement.md) 49 | - [函数](ecmascript-5/function.md) 50 | - [作用域](ecmascript-5/scope.md) 51 | - [特殊函数](ecmascript-5/special-function.md) 52 | - [闭包](ecmascript-5/closer.md) 53 | - [对象](ecmascript-5/object.md) 54 | - [JSON](ecmascript-5/json.md) 55 | - [Function 对象](ecmascript-5/function-object.md) 56 | - [原型](ecmascript-5/prototype.md) 57 | - [继承](ecmascript-5/inherit.md) 58 | - [引用类型](ecmascript-5/reference-type.md) 59 | - [数组](ecmascript-5/array.md) 60 | - [正则表达式](ecmascript-5/regular-expression.md) 61 | - [字符串](ecmascript-5/string.md) 62 | 63 | ### DOM 64 | 65 | - []() 66 | 67 | ### BOM 68 | 69 | - []() 70 | 71 | ### jQuery 72 | 73 | - [jQuery 入门](jquery/getting-started.md) 74 | - [jQuery 选择器](jquery/jquery-selector.md) 75 | - [jQuery DOM 操作](jquery/jquery-dom.md) 76 | - [jQuery 事件](jquery/jquery-event.md) 77 | - [jQuery 动画](jquery/jquery-animation.md) 78 | - [类数组操作](jquery/like-array-object.md) 79 | - [jQuery UI](jquery/) 80 | - [jQuery 插件](jquery/jquery-plugin.md) 81 | 82 | ### Ajax 83 | 84 | - []() 85 | 86 | ### Bootstrap 87 | 88 | - [响应式页面的四大核心要素](bootstrap/writing-responsive-web-design.md) 89 | - [Bootstrap 起步](bootstrap/getting-started.md) 90 | - [全局 CSS 样式](bootstrap/bootstrap-css.md) 91 | - [Bootstrap 组件](bootstrap/components.md) 92 | - [Bootstrap 插件](bootstrap/javascript.md) 93 | - [Less](bootstrap/less.md) 94 | 95 | ### AngularJS 96 | 97 | - []() 98 | 99 | ## 版权 100 | 101 | 本套课程的文本内容免费开源,任何人都可以免费学习、分享,甚至可以进行修改。但需要注明作者及来源,并且不能用于商业。 102 | 103 | 本套课程采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可。 104 | 105 | 知识共享许可协议
-------------------------------------------------------------------------------- /bootstrap/getting-started.md: -------------------------------------------------------------------------------- 1 | ## 什么是BOOTSTRAP 2 | 3 | ### 1)BOOTSTRAP概述 4 | 5 | Bootstrap 是 Twitter 公司开发的一个基于 HTML、CSS、JavaScript 的技术框架,符合 HTML、CSS 规范,且代码简介、视觉优美。 6 | 7 | Bootstrap 集合 HTML、CSS 和 JavaScript,使用了最新的浏览器技术,为实现快速开发提供了一套前端工具包。使用 Bootstrap 不仅可以构建出非常优雅的 HTML 页面,而且占用资源非常少,使用 gzip 压缩后大小仅用 10KB。并且 Bootstrap 在跨浏览器兼容方面表示也很好。 8 | 9 | ### 2)选择BOOTSTRAP的理由 10 | 11 | * Bootstrap 的 HTML 是基于 HTML5 的最新技术。 12 | * Bootstrap 可以快速实现响应式页面。 13 | * Bootstrap 集成了非常友好的 CSS 样式表,对于非设计人员也可以制作出很漂亮的网页。 14 | 15 | ### 3)BOOTSTRAP提供的功能 16 | 17 | 根据 Bootstrap 官网提供的文档,可以知道 Bootstrap 分为以下几个模块: 18 | 19 | * 全局 CSS 样式:提供了格栅系统、表格、表单、按钮等集成样式。 20 | * 组件:提供了下拉菜单、输入框、导航、列表组等组件。 21 | * 插件:提供了模态框、滚动监听、警告框、弹出框等插件。 22 | 23 | ### 4)BOOTSTRAP的版本变化 24 | 25 | * 2011年8月,Twitter 推出了 Bootstrap 1 版本,该工具由 Twitter 的设计师 Mark Otto 和 Jacob Thornton 合作完成。 26 | * 2012年1月,Twitter 推出了 Bootstrap 2 版本。相比 Bootstrap 1 版本,Bootstrap 2 添加了响应式设计、采用 12 栏栅格布局,并且清晰地划分出 CSS 布局、组件和插件等功能。 27 | * 2013年8月,Twitter 推出了 Bootstrap 3 版本。在这个版本中,采用移动优先和更好的盒子模型等。并且官方不再支持 IE 7及以下版本的浏览器。 28 | * 目前,Bootstrap 4 只是开发者预览版。 29 | 30 | ## 下载BOOTSTRAP 31 | 32 | ### 1)Bootstrap 官网及下载地址 33 | 34 | * Bootstrap 官网:[http://getbootstrap.com](http://getbootstrap.com) 35 | * Bootstrap 下载地址:[http://getbootstrap.com/getting-started/#download](http://getbootstrap.com/getting-started/#download) 36 | 37 | ### 2)Bootstrap 使用的两种方式 38 | 39 | * 将 Bootstrap 提供的压缩包下载,导入到工程目录中使用。 40 | * 使用 CDN 加速服务,例如以下内容: 41 | 42 | ```html 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | ``` 55 | 56 | ### 3)Bootstrap 目录结构及说明 57 | 58 | 下载压缩包之后,将其解压缩到任意目录即可看到以下(压缩版的)目录结构: 59 | 60 | ``` 61 | bootstrap/ 62 | ├── css/ 样式库 63 | │ ├── bootstrap.css 样式文件 64 | │ ├── bootstrap.css.map 65 | │ ├── bootstrap.min.css 压缩后的样式文件 66 | │ ├── bootstrap-theme.css 主题文件 67 | │ ├── bootstrap-theme.css.map 68 | │ └── bootstrap-theme.min.css 压缩后的主题文件 69 | ├── js/ 核心 js 文件 70 | │ ├── bootstrap.js 核心 js 文件 71 | │ └── bootstrap.min.js 压缩后的核心 js 文件 72 | └── fonts/ 字体库 73 | ├── glyphicons-halflings-regular.eot 74 | ├── glyphicons-halflings-regular.svg 75 | ├── glyphicons-halflings-regular.ttf 76 | ├── glyphicons-halflings-regular.woff 77 | └── glyphicons-halflings-regular.woff2 78 | ``` 79 | 80 | ## 对浏览器的支持情况 81 | 82 | ### 1)目前支持的浏览器 83 | 84 | | | Chrome | Firefox | Internet Explorer | Opera | Safari | 85 | | --- | --- | --- | --- | --- | --- | 86 | | Android | 支持 | 支持 | N/A | 不支持 | N/A | 87 | | IOS | 支持 | N/A | N/A | 不支持 | 支持 | 88 | | Mac OS X | 支持 | 支持 | N/A | 支持 | 支持 | 89 | | Windows | 支持 | 支持 | 支持 | 支持 | 不支持 | 90 | 91 | ### 2)IE 8及之前版本的兼容 92 | 93 | * 对 HTML 5 提供的新元素,需要通过 html5shiv.js 库进行兼容。 94 | * 对 CSS 3 提供的媒体查询,需要通过 respond.js 库进行支持。 95 | 96 | 需要在使用 Bootstrap 框架的页面 head 元素中,插入以下内容: 97 | 98 | ```html 99 | 100 | 101 | 105 | ``` 106 | 107 | ### 3)IE 兼容模式 108 | 109 | Bootstrap 不支持 IE 古老的兼容模式。为了让 IE 浏览器运行最新的渲染模式下,建议将此 `` 元素加入到页面中: 110 | 111 | ```html 112 | 113 | ``` 114 | 115 | ### 4)国产浏览器高速模式 116 | 117 | 国内浏览器厂商一般都支持兼容模式(即 IE 内核)和高速模式(即 webkit 内核),不幸的是,所有国产浏览器都是默认使用兼容模式,这就造成由于低版本 IE (IE8 及以下)内核让基于 Bootstrap 构建的网站展现效果很糟糕的情况。 118 | 119 | 将下面的 `` 元素加入到页面中,可以让部分国产浏览器默认采用高速模式渲染页面: 120 | 121 | ```html 122 | 123 | ``` 124 | 125 | ## box-sizing 126 | 127 | Bootstrap 默认使用的盒子模型是 border-box,可能会和一些第三方组件冲突。 128 | 129 | 为了避免 Bootstrap 设置的全局盒模型所带来的影响,可以重置单个页面元素或覆盖整个区域的盒模型。 130 | 131 | * 覆盖单个页面元素 132 | 133 | ```css 134 | /* 通过 CSS 代码覆盖单个页面元素的盒模型 */ 135 | .element { 136 | -webkit-box-sizing: content-box; 137 | -moz-box-sizing: content-box; 138 | box-sizing: content-box; 139 | } 140 | ``` 141 | 142 | * 重置整个区域 143 | 144 | ```css 145 | /* 通过 CSS 代码重置整个区域 */ 146 | .reset-box-sizing, 147 | .reset-box-sizing *, 148 | .reset-box-sizing *:before, 149 | .reset-box-sizing *:after { 150 | -webkit-box-sizing: content-box; 151 | -moz-box-sizing: content-box; 152 | box-sizing: content-box; 153 | } 154 | ``` 155 | 156 | ## 基本模板 157 | 158 | Bootstrap 提供了一个最基本的 HTML 模板,基于这个模板开始实现 Bootstrap 响应式页面。 159 | 160 | ```html 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | Bootstrap最基本的HTML模板 172 | 173 | 174 | 175 | 176 | 180 | 184 | 185 | 186 |

你好,世界!

187 | 188 | 192 | 193 | 194 | 195 | 196 | 197 | ``` -------------------------------------------------------------------------------- /bootstrap/less.md: -------------------------------------------------------------------------------- 1 | ## Less 概述 2 | 3 | ### 1)动态样式语言 4 | 5 | CSS 是一门非程序式语言,没有变量、函数、作用域等概念。CSS 被称之为 **静态样式语言**,从而导致样式文件的修改和维护困难。 6 | 7 | **动态样式语言** 是指,在静态样式语言的基础上,添加了一门真正的语言所必需的元素:变量、数据类型、运算、逻辑结构、函数、继承等,从而大大提高样式的可修改和可维护性。 8 | 9 | ### 2)什么是 Less 10 | 11 | Less 是一门 CSS 预处理语言,它扩展了 CSS 语言,增加了变量、Mixin、函数等特性,使 CSS 更易维护和扩展。 12 | 13 | Less 官网:[http://www.lesscss.net/](http://www.lesscss.net/) 14 | 15 | ### 3)如何使用 Less 16 | 17 | #### a. 在客户端使用 18 | 19 | * 在 HTML 页面的 `` 元素内引入 `.less` 样式文件(**`rel`**属性值为`stylesheet/less`)。 20 | 21 | ```css 22 | @base: #f938ab; 23 | 24 | .box-shadow(@style, @c) when (iscolor(@c)) { 25 | box-shadow: @style @c; 26 | -webkit-box-shadow: @style @c; 27 | -moz-box-shadow: @style @c; 28 | } 29 | .box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) { 30 | .box-shadow(@style, rgba(0, 0, 0, @alpha)); 31 | } 32 | .box { 33 | color: saturate(@base, 5%); 34 | border-color: lighten(@base, 30%); 35 | div { .box-shadow(0 0 5px, 30%) } 36 | } 37 | ``` 38 | 39 | * 下载 `less.js` 文件,在 `` 元素内引入。 40 | 41 | > **值得注意的是:** `less` 样式文件必须在 `less.js` 文件之前引入。 42 | 43 | ```html 44 | 45 | 46 | 47 | 48 | 在客户端使用Less 49 | 50 | 51 | 52 | 53 |
54 |

标题

55 |

段落

56 |
57 | 58 | 59 | ``` 60 | 61 | #### b. 在服务器端使用 62 | 63 | 在服务器端安装 `less` 的最简单方式就是通过 `npm`(node 的包管理器)。 64 | 65 | > Node.js的安装及验证请参考《Node.js安装教程》 66 | 67 | * 通过 `npm` 工具包安装 `less`。 68 | 69 | ``` 70 | npm install less -g 71 | ``` 72 | 73 | * 通过以下命令测试 `less` 是否安装成功。 74 | 75 | ``` 76 | lessc 77 | ``` 78 | 79 | ##### 命令行方式将 `less` 文件编译成 `css` 文件。 80 | 81 | ``` 82 | lessc style.less > style.css 83 | ``` 84 | 85 | ##### 配置 WebStorm 中的 `less` 86 | 87 | 1. 点击“File”->“Setting”,弹出配置窗口。 88 | 2. 点击“Tools”->“File Watchers”。 89 | 3. 点击左下角的“加号”,选择`Less`选项。 90 | 4. 配置“Program”选项,值为`lessc`的安装路径。 91 | 92 | 保存配置后,修改任意`less`文件,即可以自动生成一个`css`文件。 93 | 94 | > **值得注意的是:**此配置只对当前项目有效。如果创建新项目,必须重新进行配置。 95 | 96 | ## Less 语法 97 | 98 | ### 1)注释 99 | 100 | CSS 形式的注释在 LESS 中是依然保留的: 101 | 102 | ```css 103 | /* Hello, I'm a CSS-style comment */ 104 | .class { color: black } 105 | ``` 106 | 107 | LESS 同样也支持双斜线的注释, 但是编译成 CSS 的时候自动过滤掉: 108 | 109 | ```less 110 | // Hi, I'm a silent comment, I won't show up in your CSS 111 | .class { color: white } 112 | ``` 113 | 114 | ### 2)变量 115 | 116 | 变量就是一次声明可以多次使用的数据。 117 | 118 | ```less 119 | @nice-blue: #5B83AD; 120 | 121 | #header { color: @ nice-blue; } 122 | ``` 123 | 124 | 输出: 125 | 126 | ```css 127 | #header { color: #5B83AD; } 128 | ``` 129 | 130 | > **值得注意的是:**LESS 中的变量为完全的‘常量’,所以只能定义一次。 131 | 132 | ### 3)混合 133 | 134 | 在 LESS 中可以定义一些通用的属性集为一个class,然后在另一个class中去调用这些属性。 135 | 136 | ```less 137 | .bordered { 138 | border-top: dotted 1px black; 139 | border-bottom: solid 2px black; 140 | } 141 | ``` 142 | 143 | 如果需要在其他 class 中引入那些通用的属性集,只需要在任何class中像下面这样调用就可以了。 144 | 145 | ```less 146 | #menu a { 147 | color: #111; 148 | .bordered; 149 | } 150 | .post a { 151 | color: red; 152 | .bordered; 153 | } 154 | ``` 155 | 156 | .bordered class里面的属性样式都会在 #menu a 和 .post a中体现出来: 157 | 158 | ```css 159 | #menu a { 160 | color: #111; 161 | border-top: dotted 1px black; 162 | border-bottom: solid 2px black; 163 | } 164 | .post a { 165 | color: red; 166 | border-top: dotted 1px black; 167 | border-bottom: solid 2px black; 168 | } 169 | ``` 170 | 171 | ### 4)带参混合 172 | 173 | 在 LESS 中,还可以像函数一样定义一个带参数的属性集合: 174 | 175 | ```less 176 | .border-radius (@radius) { 177 | border-radius: @radius; 178 | -moz-border-radius: @radius; 179 | -webkit-border-radius: @radius; 180 | } 181 | ``` 182 | 183 | 然后在其他 class 中像这样调用: 184 | 185 | ```less 186 | #header { 187 | .border-radius(4px); 188 | } 189 | .button { 190 | .border-radius(6px); 191 | } 192 | ``` 193 | 194 | ##### 为参数设置默认值: 195 | 196 | ```less 197 | .border-radius (@radius: 5px) { 198 | border-radius: @radius; 199 | -moz-border-radius: @radius; 200 | -webkit-border-radius: @radius; 201 | } 202 | ``` 203 | 204 | 这样调用: 205 | 206 | ```less 207 | #header { 208 | .border-radius; 209 | } 210 | ``` 211 | 212 | @radius 的值就是 5px。 213 | 214 | ##### @arguments 变量 215 | 216 | @arguments包含了所有传递进来的参数。 217 | 218 | ```less 219 | .box-shadow (@x: 0, @y: 0, @blur: 1px, @color: #000) { 220 | box-shadow: @arguments; 221 | -moz-box-shadow: @arguments; 222 | -webkit-box-shadow: @arguments; 223 | } 224 | .box-shadow(2px, 5px); 225 | ``` 226 | 227 | 将会输出: 228 | 229 | ```css 230 | box-shadow: 2px 5px 1px #000; 231 | -moz-box-shadow: 2px 5px 1px #000; 232 | -webkit-box-shadow: 2px 5px 1px #000; 233 | ``` 234 | 235 | ### 5)嵌套规则 236 | 237 | LESS 可以以嵌套的方式编写层叠样式。例如以下案例: 238 | 239 | ```css 240 | #header { color: black; } 241 | #header .navigation { 242 | font-size: 12px; 243 | } 244 | #header .logo { 245 | width: 300px; 246 | } 247 | #header .logo:hover { 248 | text-decoration: none; 249 | } 250 | ``` 251 | 252 | 在 LESS 中就可以这样写: 253 | 254 | ```less 255 | #header { 256 | color: black; 257 | 258 | .navigation { 259 | font-size: 12px; 260 | } 261 | .logo { 262 | width: 300px; 263 | &:hover { text-decoration: none } 264 | } 265 | } 266 | ``` 267 | 268 | > **值得注意的是:** `&` 符号的使用 269 | > 270 | > 如果想写串联选择器,而不是写后代选择器,就可以用到 `&` 了。 271 | 272 | ```less 273 | .bordered { 274 | &.float { 275 | float: left; 276 | } 277 | .top { 278 | margin: 5px; 279 | } 280 | } 281 | ``` 282 | 283 | 会这样输出: 284 | 285 | ```css 286 | .bordered.float { 287 | float: left; 288 | } 289 | .bordered .top { 290 | margin: 5px; 291 | } 292 | ``` 293 | 294 | ### 6)运算 295 | 296 | 任何数字、颜色或者变量都可以参与运算。LESS 中允许的计算有`+`、`-`、`*`、`/`和`%`。 297 | 298 | ```less 299 | @screen-width: 992px; 300 | 301 | .col-md-1 { 302 | width: floor(@screen-width/12); 303 | } 304 | ``` 305 | 306 | 将会输出: 307 | 308 | ```css 309 | .col-md-1 { 310 | width: 82px; 311 | } 312 | ``` 313 | 314 | ### 7)函数 315 | 316 | LESS 内置了几十个函数,用于颜色转换、字符串处理和数学运算等。 317 | 318 | #### a. Color 函数 319 | 320 | ```less 321 | lighten(@color, 10%); // return a color which is 10% *lighter* than @color 322 | darken(@color, 10%); // return a color which is 10% *darker* than @color 323 | 324 | saturate(@color, 10%); // return a color 10% *more* saturated than @color 325 | desaturate(@color, 10%); // return a color 10% *less* saturated than @color 326 | 327 | fadein(@color, 10%); // return a color 10% *less* transparent than @color 328 | fadeout(@color, 10%); // return a color 10% *more* transparent than @color 329 | fade(@color, 50%); // return @color with 50% transparency 330 | 331 | spin(@color, 10); // return a color with a 10 degree larger in hue than @color 332 | spin(@color, -10); // return a color with a 10 degree smaller hue than @color 333 | 334 | mix(@color1, @color2); // return a mix of @color1 and @color2 335 | ``` 336 | 337 | 例如下述案例: 338 | 339 | ```less 340 | @base: #f04615; 341 | 342 | .class { 343 | color: saturate(@base, 5%); 344 | background-color: lighten(spin(@base, 8), 25%); 345 | } 346 | ``` 347 | 348 | 将会输出: 349 | 350 | ```css 351 | .class { 352 | color: #f6430f; 353 | background-color: #f8b38d; 354 | } 355 | ``` 356 | 357 | #### b. Math 函数 358 | 359 | ```less 360 | round(1.67); // returns `2` 361 | ceil(2.4); // returns `3` 362 | floor(2.6); // returns `2` 363 | ``` 364 | 365 | ### 8)文件导入 366 | 367 | LESS 允许创建一个 main 文件(**主要用于引入其他 LESS 文件**)。 368 | 369 | > `.less` 后缀可带可不带。 370 | 371 | ```less 372 | @import "lib.less"; 373 | @import "lib"; 374 | ``` 375 | 376 | > **值得注意的是:**最后会生成一个 CSS 文件,而不是多个 CSS 文件。 377 | 378 | ### 9)定制 Bootstrap 379 | 380 | #### a. 查看 Bootstrap 源码 381 | 382 | 打开 Bootstrap 源码包中的 `less` 目录中的 `bootstrap.less` 文件: 383 | 384 | ```less 385 | // 核心变量和混合类 386 | @import "variables.less"; 387 | @import "mixins.less"; 388 | 389 | // 重置和依赖类 390 | @import "normalize.less"; 391 | @import "print.less"; 392 | @import "glyphicons.less"; 393 | 394 | // 核心类 395 | @import "scaffolding.less"; 396 | @import "type.less"; 397 | @import "code.less"; 398 | @import "grid.less"; 399 | @import "tables.less"; 400 | @import "forms.less"; 401 | @import "buttons.less"; 402 | 403 | // 组件类 404 | @import "component-animations.less"; 405 | @import "dropdowns.less"; 406 | @import "button-groups.less"; 407 | @import "input-groups.less"; 408 | @import "navs.less"; 409 | @import "navbar.less"; 410 | @import "breadcrumbs.less"; 411 | @import "pagination.less"; 412 | @import "pager.less"; 413 | @import "labels.less"; 414 | @import "badges.less"; 415 | @import "jumbotron.less"; 416 | @import "thumbnails.less"; 417 | @import "alerts.less"; 418 | @import "progress-bars.less"; 419 | @import "media.less"; 420 | @import "list-group.less"; 421 | @import "panels.less"; 422 | @import "responsive-embed.less"; 423 | @import "wells.less"; 424 | @import "close.less"; 425 | 426 | // 插件类 427 | @import "modals.less"; 428 | @import "tooltip.less"; 429 | @import "popovers.less"; 430 | @import "carousel.less"; 431 | 432 | // 工具类 433 | @import "utilities.less"; 434 | @import "responsive-utilities.less"; 435 | ``` -------------------------------------------------------------------------------- /bootstrap/viewgrid.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fullstack-kingj/front-end-notes/ca32ed4756110b4639797456b277b5cc4c622012/bootstrap/viewgrid.jpg -------------------------------------------------------------------------------- /css-basics/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fullstack-kingj/front-end-notes/ca32ed4756110b4639797456b277b5cc4c622012/css-basics/01.png -------------------------------------------------------------------------------- /css-basics/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fullstack-kingj/front-end-notes/ca32ed4756110b4639797456b277b5cc4c622012/css-basics/02.png -------------------------------------------------------------------------------- /css-basics/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fullstack-kingj/front-end-notes/ca32ed4756110b4639797456b277b5cc4c622012/css-basics/03.png -------------------------------------------------------------------------------- /css-basics/block-and-inline-element.md: -------------------------------------------------------------------------------- 1 | 大多数 HTML 元素被定义为**块级元素**或**内联元素**。 2 | 3 | ### 10. 块级元素 4 | 5 | 块级元素在浏览器显示时,通常会以新行来开始(和结束)。 6 | 7 | 我们已经学习过的块级元素有: `

`, `

`, `