【问题标题】:Two identical DIV classes, one not applying style两个相同的 DIV 类,一个不应用样式
【发布时间】:2023-02-07 11:55:08
【问题描述】:

我使用 HelpStudio 创建了两个具有相同值的 div 类,但实际上只有一个有效。

.div-important{ 
    border-radius: 10px;
    border: 0px;
    background-color: #fecfdf;
    padding-top: 5px;
    padding-right: 15px;
    padding-bottom: 2px;
    padding-left: 15px;
}   
 .div-note{ 
    border-radius: 10px;
    border: 0px;
    background: #fecfdf;
    padding-top: 5px;
    padding-right: 15px;
    padding-bottom: 2px;
    padding-left: 15px;
    
 }

这是我使用的 html:

<div class="div-important">
    <p><strong>Note<br /></strong><br />
    For dashed linetype it may not reach the final selected point.</p>
</div>

<div class="div-note">
    <p><strong>Note<br /></strong><br />
    For dashed linetype it may not reach the final selected point.</p>
</div>

And this is what I get

奇怪的是,当我昨天输入这些时,它正在工作,而今天它停止工作......这让我发疯!

我期待两个 div 都在蓝色框中显示文本,但只有其中一个这样做,我不明白为什么。

【问题讨论】:

    标签: html css


    【解决方案1】:

    问题是你有一个打字错误在类名中第二个分区.类名是分注代替 ”div-note2“。 希望能帮助到你!

    正确的 HTML:

       <div class="div-important">
            <p><strong>Note<br /></strong><br />
            For dashed linetype it may not reach the final selected point.</p>
        </div>
        <div class="div-note2">
            <p><strong>Note<br /></strong><br />
            For dashed linetype it may not reach the final selected point.</p>
        </div>
    

    【讨论】:

    • 我改变了它,但它仍然没有用。此外,它没有解释为什么 div-important 不起作用。
    【解决方案2】:

    html 具有 div-note 类,但样式具有 div-note2 类。摆脱“2”。

    【讨论】:

    • 我改变了它,但它仍然没有用。此外,它没有解释为什么 div-important 不起作用。
    猜你喜欢
    • 2021-12-26
    • 1970-01-01
    • 1970-01-01
    • 2020-08-14
    • 1970-01-01
    • 1970-01-01
    • 2014-11-05
    • 2019-09-28
    • 1970-01-01
    相关资源
    最近更新 更多