【发布时间】:2014-07-01 22:11:20
【问题描述】:
如何计算需要为 (100% - @SideBarWidth) 的 15% 的 DIV 的宽度,其中 @SideBarWidth 是我的侧边栏的宽度?为了以另一种方式描述我的问题,我希望获得我页面内容区域(不包括侧栏区域)的百分比。这可以用 CSS 和 LESS 计算吗?
我目前拥有的 LESS:
@sidebarWidth: 250px;
.myDiv
{
position: fixed;
left: @sidebarWidth;
width: calc(15% * (100% - @sidebarWidth));
}
编译时正在生成:
.myDiv
{
position: fixed;
left: 250px;
width: calc(-2250%);
}
不希望的宽度为“calc(-2250%)”。
【问题讨论】: