CSS规则中的这些#和$字符是什么?

时间:2019-01-31 07:29:54

标签: css sass

我有一堆CSS代码,但是它的规则名称带有#和$,这些字符是做什么用的?

.popup-inner-video {
    #max-width:700px;
    width:70%;
    height: 70% !important;
    padding:40px;
    position:absolute;
    top:50%;
    left:50%;
    -webkit-transform:translate(-50%, -50%);
    transform:translate(-50%, -50%);
    box-shadow:0px 2px 6px rgba(0,0,0,1);
    border-radius:3px;
    background:#fff;
    position: relative;
    $padding-bottom: 56.25%;
    #padding-top: 35px;
    height: 0;
    overflow: hidden;
}

如您所见

#max-width:700px;
$padding-bottom: 56.25%;
#padding-top: 35px;

这些#和$字符是做什么用的?

2 个答案:

答案 0 :(得分:0)

# is for the referring id and $ is for the sass model CSS and it is used when we reuse the code.

for example :

# >
<div id="idrefer"> Hello</div>
#idrefer{
// do your style
}

$ >
<div id="idrefer"> Hello</div>
sass
//globle declaration
$color:yellow;

#idrefer{
color:$color
}

答案 1 :(得分:0)