将css转换为更少

时间:2015-01-26 11:48:05

标签: css less

我试图将一些css转换为更少,但在编译时我遇到了一些错误? 这是我在css中的内容,如何将其转换为更少

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #2AABE2;
    background: rgba(42, 171, 226, 0.5);
    display: none;
    -khtml-opacity: 0.80;
    opacity: 0.80;
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha"(Opacity=60);
    filter: progid:DXImageTransform.Microsoft.Alpha(opacity=60);
    filter:alpha(opacity=60);
    z-index: 20000;
    text-align: center;
}
.preloader-text {
    color: white;
    font-size:16px !important;
    margin: auto auto 10px;
}
.preloader-holder {
    background-position: center center;
    background-repeat: no-repeat;
    height: 200px;
    left: 50%;
    margin: -100px 0 0 -200px;
    position: absolute;
    top: 50%;
    width: 400px;
}

2 个答案:

答案 0 :(得分:2)

只需使用escape character ~

#preloader {
    ....
    -ms-filter:~'progid:DXImageTransform.Microsoft.Alpha"(Opacity=60)';
    filter: ~'progid:DXImageTransform.Microsoft.Alpha(opacity=60)';
    ....
}

记得使用单引号来包含整个字符串,因为值已经包含了双重字符串。

答案 1 :(得分:0)

尝试使用〜

为字符串添加前缀
-ms-filter: ~"progid:DXImageTransform.Microsoft.Alpha(opacity=60)";

-ms-filter: e("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");

查看string functions on less docs