[英]Overriding CSS with .less in Joomla
我正在尝试使用.less来修改Joomla龙门模板。 我尝试使用“ aa”类更改的文本已链接了音频,因此整个文本显示为蓝色,而我尝试将其更改为深棕色。 这是我在.less文件中使用的内容:
.aa {
cursor: url(/images/listen.cur), progress !important;
color: @2E1507;
}
这很简单,但是如果没有“ progress!important”,我就无法更改光标,这对我来说没有意义。 现在,我正在尝试更改颜色,但是我找不到办法。 尝试更改这些样式时,我缺少一些重要的东西吗?
我认为@ seven-phases-max首先为您提供正确的答案。 LESS中的!important
与CSS中的含义相同。 您将使用!important
否决CSS特异性规则 。 在大多数情况下,使用!important不是一个好主意,而是尝试查找具有更高特异性的选择器。 另请阅读: http : //css-tricks.com/when-using-important-is-the-right-choice/ 。 使用!important
一个原因是实用程序类。 也许这就是为什么您也选择在这里使用它。
progress
设置了您的光标类型,请参见http://www.w3schools.com/cssref/pr_class_cursor.asp 。 因为您已经为此使用了url()
,所以progress
应该没有任何效果( auto
是默认样式)。
请注意,如果需要!important
来设置光标,则可能还需要它来设置颜色: color: #2E1507 !important;
在LESS中使用mixin时,您可以设置!important;。 对于您的所有财产,一次是:
.importantaudio(){
cursor: url(/images/listen.cur), progress;
color: #2E1507;
}
.aa{ .importantaudio() !important;}
CSS(结果):
.aa {
cursor: url(/images/listen.cur), progress !important;
color: #2E1507 !important;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.