有没有办法在Less中获取另一个元素值? [英] Is there any way to get another element value in Less?
本文介绍了有没有办法在Less中获取另一个元素值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是的新用户。
在我的脚本中,我想使用<在
box2
中的 box1
的code> $ b
请查看我的脚本。
#box1
{
width :1000px;
height:500px;
}
#box2
{
width:#box1.width - 100px;
}
是否可能?如果是,请提供正确的少
代码。
解决方案
不幸的是是不可能的。你可以使用变量,并做这样的事情:
@ box1width:1000px;
#box1
{
width:@ box1width;
height:500px;
}
#box2
{
width:@ box1width - 100;
}
I'm new to Less
.
In my script, I'd like to use the width
of box1
in box2
.
Please review my script.
#box1
{
width: 1000px;
height: 500px;
}
#box2
{
width: #box1.width - 100px;
}
Is it possible or not? If yes, please give me correct Less
code.
解决方案
unfortunatly it is indeed not possible. You could work with variables and do something like this however:
@box1width: 1000px;
#box1
{
width: @box1width;
height: 500px;
}
#box2
{
width: @box1width - 100;
}
这篇关于有没有办法在Less中获取另一个元素值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文