Overwrite less mixin

瘦欲@ 提交于 2019-12-01 16:44:50

Less works exactly like CSS does in this respect. For example, if you wrote this CSS:

p { border: 1px solid black; }

It would give all paragraphs a black border. If later in the document you added:

p { }

You wouldn't expect it to overwrite your previous definition, right?

So, in this case it's the expected behaviour, you need to specifically overwrite the CSS values you want to overwrite.

Starting from lesscss 1.7.0, this should be possible by using "detached rulesets", but unfortunately, even with 1.7.5 I get "ParseError: Unrecognised input" when I try the use the detached ruleset syntax

http://lesscss.org/features/#detached-rulesets-feature

[EDIT]: I got the parse error because I dropped the semi-colon after the ruleset definition, but it works fine - ruleset does not have parameters, it is actually a variable, so it's definition can be overriden

If you are importing Bootstrap less files in your project then you can try to edit/overwrite the Bootstrap component radius variables:

@border-radius-base: 0px;
@border-radius-small: 0px;
@border-radius-large: 0px;

if not then you can recompile and download Bootstrap CSS code setting 0px values to those variables in http://getbootstrap.com/customize/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!