【问题标题】:Why I can't put all desired styles under the same group while in an css file (VSCode)为什么在 css 文件(VSCode)中我不能将所有需要的样式放在同一个组中
【发布时间】:2018-05-25 14:05:52
【问题描述】:

我必须继续写说:

p {
color: red
}
p {
padding: 30px
}

而不仅仅是

p {
color: red
padding: 30px
}

html file with the href

Please check line 9, where the attribute is not accepted

【问题讨论】:

    标签: html css visual-studio-code


    【解决方案1】:

    您需要在您的 css 中添加分号以使第一个示例有效。

    CSS 中的属性:值对后需要一个分号 ( ; ) 风格。

    https://msdn.microsoft.com/en-us/library/93t4wab3(v=vs.71).aspx

    p {
    color: red;
    padding: 30px;
    }
    <p>testing</p>

    【讨论】:

      【解决方案2】:

      嗯,首先样式表的链接应该在 head 标签中,其次你应该添加一个 ;在每个属性之后:css中的值,所以它应该像

      p {
        color: red;
        padding: 30px;
      }
      

      【讨论】:

        猜你喜欢
        • 2015-01-11
        • 2020-07-07
        • 1970-01-01
        • 1970-01-01
        • 2012-05-18
        • 2022-12-13
        • 2012-02-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多