less

Calculating width from percent to pixel then minus by pixel in LESS CSS

ε祈祈猫儿з 提交于 2019-11-29 18:51:01
I will calculate width in some element from percent to pixel so I will minus -10px via using LESS and calc() . It´s possible? div { span { width:calc(100% - 10px); } } I using CSS3 calc() so it doesn't work: calc(100% - 10px) Example: if 100% = 500px so width = 490px (500-10); I made a demo for testing : http://jsfiddle.net/4DujZ/55/ so padding will say: 5 (10px / 2) all the time when I resizing. Can I do it in LESS ? I know how to do in jQuery and simple CSS like margin padding or else... but i will try to do functional in LESS with calc() You can escape the calc arguments in order to prevent

LESS CSS retina media queries without redundancy

≡放荡痞女 提交于 2019-11-29 18:06:33
I am using a component-based CSS style, so I have been using mixins to allow me to use media queries without accidentally compiling hundreds of them. This is what I am doing for screen sizes: Main file: .mq-medium() {} @import //other files @media only screen and (min-width: 600px) { .mq-medium; } Another file: .mq-medium() { .banner { width: 50%; } } This can be used several times and results in grouped queries. The Problem I am trying to do the same thing for retina background-image queries, and am having trouble figuring out how to do so. This is my test: .mq-retina() { } .background-image(

LESS - set variables on the client side

微笑、不失礼 提交于 2019-11-29 17:30:49
I have created a LESS ( http://lesscss.org/ ) version of a simple css grid solution ( http://simplegrid.info/ . Now I can happily roll my own grid sizes with the server script from LESS (lessc). That's working for me. For demo purposes I would like to create a HTML page, where I can put the size of the css grid in a textbox and the the grid would change dynamically. Beginning of the demo is here: http://jsfiddle.net/8QHNc/ So instead of changing @layoutwidth: 720px; in the <style rel="stylesheet" type="text/less" > section I would like to pass these variables to the LESS interpreter. Can these

LESS mixin recursion error to convert pixels to rems

不问归期 提交于 2019-11-29 17:12:14
I am trying to make a mixin to propery convert pixels to relative ems. I would like it to be flexible enough to allow any property to be used with any number of pixel values. Any ideas on how to add multiple values to a single property without the recursion error I'm creating inside the for loop? desired usage example 1: .pixels-to-rems(font-size; 10); desired output: font-size: 10px; font-size: 1rem; desired usage example 2: .pixels-to-rems(padding; 10,0,20,10); desired output: padding: 10px, 0px, 20px, 10px; padding: 1rem, 0px, 2rem, 1rem; Here's the mixin as is. @baseFontSize: 10px; .pixels

LESS CSS, @import path from variable

佐手、 提交于 2019-11-29 17:00:36
问题 I want to declare a variable with the path to the library: @libPath: "any/path/to/lib"; And use it in @import . Something like this: @import "@{libPath}/file.less"; And I see the result after processing: @import url("@{libPath}/file.less"); No such possibility or am I doing something wrong? Thanks. 回答1: FWIW this is a bug in less.js that’s been discussed for way over a year now. There are at least two attempts to fix this but one requires large changes to the public API and has consequently

LESS building a string in a loop for dynamic gradient

只谈情不闲聊 提交于 2019-11-29 16:41:20
So here's what I'm trying to do. I want to be able to send in a few different colors and percentages, as a dynamic length list, to a LESS loop, to create a gradient. At the same time, I'd also like to prepend browser prefixes. The reason for this request is because I'm using CSS gradients in place of graphics for speed and minimizing requests. Here's how I'm doing it now, but I'd like a better, more flexible solution: .mkgrad(@gclrs, @gdir) { @m:length(@list); .looppref(@m, @j: 1) when (@j =< @m) { @mypref: extract(@list, @j); background:~"@{mypref}-linear-gradient(@{gdir}, @{gclrs})";

How to invert colors in LESS

∥☆過路亽.° 提交于 2019-11-29 16:29:55
问题 Is there a particular color operation I'm not seeing where you can invert colors? I'm seeing lots of color methods but could not see a way to do this. reference: http://lesscss.org/ 回答1: There are multiple interpretation of inverting color. You want a color with the opposite hue: spin(@color, 180) You want a color that the sum with current one is white: #fff - @color 回答2: I don't think there is a specific function to invert colors, but what you could do is set your colors as variables. e.g.:

IDE with syntax highlight support for LESS

你。 提交于 2019-11-29 16:08:19
问题 Is there any IDE with syntax highlight support for LESS? 回答1: Eclipse does not support .less fully (nested rules, single line comments, etc) but you can at least configure it so that it would open .less files and treat them as .css. Preferences > General > Content Types: find "CSS" entry and add .less extension. Then, Preferences > General > Editors > File Assoc: add .less extension and associate with CSS editor. Better than nothing, especially if you're into Eclipse world ;) 回答2: JetBrains

SQL注入案例

跟風遠走 提交于 2019-11-29 15:07:51
文章目录 1. 首先构造闭合,只有闭合成功之后才能实现后面的sql语句 2. 然后使用order by 函数来查看有多少列,具体使用如下(建议使用二分法) 3. 接下来查看显示位是哪几位,使用union联合查询,先将id改为-1,这样才能使union后的sql语句执行显示出结果。 4. 使用databa()函数和version()函数查看库名和版本号 5. 由步骤4可知库名为security,再根据库名输出该库的所有表名 6. 由步骤4,5可知库名为security,表名有users,Emails等等。我们可以尝试查询users表的列名 7. 根据库名security和表名users可以得知users中的列有password,username ,id这些列名,我们就可以根据这些列名查找到我们想要的信息 8. 最后查找到users的用户名和密码如上图所示(即sql注入完成) 1. 首先构造闭合,只有闭合成功之后才能实现后面的sql语句 进行检测 依次以下方式进行检测,使用 http://192.168.1.129/sqli-labs-master/Less-3/?id=1 and 1=2--+ http://192.168.1.129/sqli-labs-master/Less-3/?id=1’ and 1=2--+ http://192.168.1.129/sqli-labs

add a rule to an element only if it has a certain child

不羁岁月 提交于 2019-11-29 14:46:21
Is there a way of adding CSS rules to an element only if it has an certain child element ? I do know it is not possible to do it with CSS, but I'm not sure if it is possible to do it with LESS. If it is not possible with CSS, then it is not possible with LESS, which compiles to plain old vanilla CSS. The problem is, that the LESS is compiled without knowledge of the HTML it is applied to, and without any client side scripting. Therefore, it is impossible to achieve anything with LESS that can not be achieved by using CSS alone. You could achieve what you want by using client side javascript,