【问题标题】:What are these # and $ characters in css rules?css 规则中的这些 # 和 $ 字符是什么?
【发布时间】:2019-01-31 17:38:34
【问题描述】:

我有一堆 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;

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

【问题讨论】:

  • 您使用的是 SCSS 还是 SASS ? $用于在SASS中声明变量
  • 这个网站不是我的。我有一个解析 CSS 文档的项目。我正在测试这个 CSS 文档,我得到了一个错误,它告诉我这个文档是错误的。所以,我不知道这个文档到底是什么。
  • 不能只用一个类代码说,如果它的嵌套代码那么它肯定是 SASS。检查this
  • 这是真正的文档,请检查此代码后告诉我这是什么。 zulukds.com/css/style.css
  • 该文件是一个库 CSS 文件,但最后有人通过包含该代码弄乱了它。我认为,您应该检查这是否是相关代码,否则将其删除。显然带有# and $ 的变量在那里不起作用,它们在那里毫无用处,找到你需要做的事情并改变它们。

标签: css sass


【解决方案1】:
# 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
}

【讨论】:

    【解决方案2】:
    猜你喜欢
    • 2011-02-12
    • 2020-03-17
    • 2019-09-27
    • 2010-12-09
    • 2011-10-22
    • 2011-12-14
    • 1970-01-01
    • 2011-05-20
    • 1970-01-01
    相关资源
    最近更新 更多