Html 如何在Sass中使用Javascript?
所以我把这个代码放在我的Sass文件中Html 如何在Sass中使用Javascript?,html,css,sass,compass-sass,Html,Css,Sass,Compass Sass,所以我把这个代码放在我的Sass文件中 width: 100%; height: auto; overflow: hidden; display: block; display: -webkit-box; height: $ font-size *$ line-height *$ lines-to-show; font-size: $ font-size; -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-overflow: el
width: 100%;
height: auto;
overflow: hidden;
display: block;
display: -webkit-box;
height: $ font-size *$ line-height *$ lines-to-show;
font-size: $ font-size;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
代码限制了应显示的行数
但它对Sass不起作用 我不知道怎么修这个
我搜索了这类问题,但找不到它。您需要更改变量($sampleVariable),并删除
$
后面的空格。此外,您还需要定义在文件顶部使用的变量,以便进行编译
您的示例代码可以如下所示:
// variable definition
$font-size: 1em;
$line-height: 1.3;
$lines-to-show: 3;
// rest of the code
.selector {
width: 100%;
height: auto;
overflow: hidden;
display: block;
display: -webkit-box;
height: $font-size * $line-height * $lines-to-show; // no spaces between $ and variable name
font-size: $ font-size;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
}
如果这回答了你的问题,你能把它标记为答案吗?当然,对不起,我忘了