less

Sass和LESS-动态CSS技术

笑着哭i 提交于 2019-11-30 15:07:09
一、简介 二、Sass/Scss的使用 变量 注释 css 中注释的作用包括帮助你组织样式、以后你看自己的代码时明白为什么这样写,以及简单的样式说明。但是,你也并不希望每个浏览网站源码的人都能看到所有注释。 因此,scss注释方式有两种: body { color: #333; // 这种注释内容不会出现在生成的css文件中 padding: 0; /* 这种注释内容会出现在生成的css文件中 */ } 混合宏mixin VS 继承 VS 占位符 什么时候用 混合宏 ,什么时候用 继承 ,什么时候使用 占位符 ?三者各有优缺点,详细比较可以参考 http://www.imooc.com/code/7041 ,总的来说就是: 优先使用占位符,如果一定需要基类则用继承,如果需要传递参数则使用混合宏mixin。 下图同样是上面链接中关于三者比较的一张图片。 运算 运算包括数字运算、变量运算 数字运算包括:加法、减法、乘法和除法等运算, SASS的编译输出格式 Sass/Scss 编译后生成的CSS的式样格式有: expanded nested compact compressed 其中expanded是默认的格式,和我们平时手动书写CSS的一致,所有式样都是展开的。 nested:输出CSS是,根据在Scss中的“嵌套”显示相应的缩进,嵌套的越深,缩进的越多。 compact

Can numbers be rounded (math term) using LESS CSS?

青春壹個敷衍的年華 提交于 2019-11-30 14:42:01
问题 LESS CSS = http://lesscss.org/ I declared a variable, like this... @height: 30px Then I used a simple calculation, like this... line-height: @height * .666 It returns 19.98px but I wanted an even 20px So, does LESS CSS have a way to round numbers up or down? 回答1: Yes they can: line-height: ceil(@height * .666); // 20px (round up) line-height: floor(@height * .666); // 19px (round down) line-height: round(@height * .666); // 20px (round to closest integer) line-height: round(@height * .666, 1)

LESS: using font-awesome in :before

*爱你&永不变心* 提交于 2019-11-30 14:18:09
I want to have a CSS selector for a header with custom font, color and a bullet to the left. So I want my header to use my custom font, and it's :before pseudo-element to use font-awesome. So I would like my :before to have the .fa class, while the whole element doesn't have this class. I have this html: <h1 class="bulleted-header">Hello</h1> And I would like to write something like this in LESS: .bulleted-header { color: #61cbe6; font: 16px 'ds_goose', sans-serif; &:before { content: @fa-var-bullseye; // font-awesome's bullet icon .fa; // calling font-awesome's class. DOESN'T COMPILE } } The

Using a variable in a selector in LESS

假如想象 提交于 2019-11-30 13:53:51
I have a variable @index and I want to output a selector so that when @index is 3 , the selector is [data-sth="3"] . Longer example: @index: 3; /* selector here */ { color: red; } Desired output: [data-sth="3"] { color: red; } I've tried a few things, but haven't managed to get anything that works, yet. Thanks. callumacrae See Variable Interpolation . I.e.: [data-sth="@{index}"] { color: red; } Original answer (Less versions before 1.40): The following code should work: (~'[data-sth="@{index}"]') { color: red; } The ~ removes the quotation marks. 来源: https://stackoverflow.com/questions

How to ignore certain LESS files in Web Essentials LESS compiling? (Bootstrap)

自古美人都是妖i 提交于 2019-11-30 13:44:14
问题 I've set up Web Essentials 2013 (in Visual Studio 2012) and loaded in the default Twitter Bootstrap LESS source files. Auto-build and minification is working perfectly, except Web Essentials quite overdoes the job. When I select " bootstrap.less ", make a change and save it, Web Essentials creates a new " bootstrap.css " as well as a " bootstrap.min.css " with everything inside I need. But when I edit e.g. buttons.less , it creates a buttons.css (and buttons.min.css ) too (with all the

获取响应时长

给你一囗甜甜゛ 提交于 2019-11-30 13:29:08
total_seconds 总时长,单位秒 days 以天为单位 microseconds (>= 0 and less than 1 second) 获取微秒部分,大于0小于1秒 seconds Number of seconds (>= 0 and less than 1 day) 秒,大于0小于1天 max = datetime.timedelta(999999999, 86399, 999999) 最大时间 min = datetime.timedelta(-999999999) 最小时间 resolution = datetime.timedelta(0, 0, 1) 最小时间单位 来源: https://www.cnblogs.com/yaohu/p/11593632.html

Is there polyfill for css transform property in IE8

試著忘記壹切 提交于 2019-11-30 13:27:50
问题 I have the following mixin for cross-browser transform: .transform (...) { -webkit-transform: @arguments; /* Chrome, Opera 15+, Safari 3.1+ */ -moz-transform: @arguments; /* Firefox 3.5+ */ -ms-transform: @arguments; /* IE 9 */ -o-transform: @arguments; /* Opera 10.5+ */ transform: @arguments; /* Firefox 16+, IE 10+, Opera */ } .translate(@x:0, @y:0) { .transform(translate(@x, @y)); } And apply it something like the following: #main { .translate(280px, 0); } But it's not wotk in IE8 and Opera

How to convert a numeric value into a percentage (or) append percentage symbol to a number?

天大地大妈咪最大 提交于 2019-11-30 13:04:43
I'm trying to use LESS css to do the following: width: ((480/1366)*100)+'%'; The problem though is that the output becomes: width: 35.13909224011713 '%'; How do I make it workable? ie.: width: 35.13909224011713%; ldiqual It is possible to use string interpolation : @myvar: ((480/1366)*100); width: ~"@{myvar}%"; That will output width: 35.13909224011713%; Additionally, if you want it to be rounded, you can use round() . Even though this question is quite old, I want to add a few more examples about adding. Less will set your units to whatever is being operated on. 10px + 20px will output 30px

常用的Linux命令

让人想犯罪 __ 提交于 2019-11-30 12:43:50
学习链接: linux命令学习1 linux命令学习2 常用命令: history history命令就是历史记录. 它显示了在终端中所执行过的所有命令的历史. 参考链接: 1. 对Linux新手非常有用的 20个命令 grep 管道, 过滤, 作为linux中最为常用的三大文本(awk, sed, grep)处理工具之一, grep命令的常用格式为: grep [选项] "模式" [文件] , grep家族总共有三个: grep , egrep , fgrep , 一般常用grep. 扩展选项如下:  -E : 开启扩展Extend的正则表达式. -i : 忽略大小写ignore case. -n : 显示行号 -w : 被匹配的文本只能是单词, 而不能是单词中的某一部分, 如文本中有liker, 而我搜寻的只是like, 就可以使用-w选项来避免匹配liker --color :将匹配到的内容以颜色高亮显示. 参考链接: 1. linux中grep命令的用法 awk 1. awk学习 sed 1. sed学习 xxx --help(man xxx) xxx --help, 是对xxx命令的常用选项和用法格式的一个介绍, man xxx也是介绍, man的内容比较复杂是详细介绍, xxx --help比较简洁, 简单介绍 pwd 当前路径(dirs) l(ls)

flexible less 使用

孤者浪人 提交于 2019-11-30 12:00:59
html < html lang = " en " > < head > < meta charset = " UTF-8 " > < meta http-equiv = " X-UA-Compatible " content = " ie=edge " > < title > test </ title > < script src = " lib/flexible_css.js,flexible.js " > </ script > < link rel = " stylesheet " href = " css/css.css " > </ head > < body > < div class = " a " > </ div > < div class = " b " > </ div > </ body > </ html > less(vscode使用easy less转换) // 设计稿宽度 单位px 如果是750 请使用375宽度的手机开发 @DesignWidth : 750 ; @BaseFontSize : @DesignWidth /10 ; // 函数式 // . rem ( width,100 ) ; . rem ( @name , @px ) { @ { name } : unit ( @px / @BaseFontSize , rem ) ; }