Sass样式不适用于内容

时间:2019-03-30 02:12:04

标签: html css sass

当我嵌套它们时,不会应用我的SASS样式。我不明白为什么,如果没有嵌套,它们会完美地工作。我以前从未遇到过这个问题,这一次不适用样式似乎很奇怪。当我删除:nth-​​of-type(1)部分时,它也可以工作。我觉得这有点奇怪,因为我特别需要将其与“ shop-sec”和其他“ shop-sec”分开。谢谢。

.shop-sec:nth-of-type(1) {
    height: 500px auto;
    background-color: white;
    margin-top: 75px;
    display: grid;
    position: relative;
    grid-template-columns: .75fr 1.25fr 1.25fr .75fr;
    grid-gap: 15px;

    .shop-sec-content {
        width: 100%;
        height: 100%;
    }

    .shop-sec-content img {
        width: 100%;
        height: auto;
    }

    .shop-sec-content:nth-of-type(1) {
        position: relative;
    }

    .shop-sec-content:nth-of-type(1) .shop-sec-text {
        position: absolute;
        right: 0;
        padding-right: 50px;
        transform: rotate(-90deg);
        top: 42.5%;
        font-size: 20px;
        font-weight: bold;
    }

    .shop-sec-content:nth-of-type(4) {
        position: relative;
    }

    .shop-sec-content:nth-of-type(4) .shop-sec-text {
        position: absolute;
        left: 0;
        padding-left: 50px;
        top: 42.5%;
        font-size: 20px;
        font-weight: bold;
    }

    .shop-sec-content:nth-of-type(2) {
        position: relative;
    }

    .shop-sec-content:nth-of-type(2) .shop-sec-content-text {
        position: absolute;
        top: 50%;
        margin-left: 50px;
        font-size: 16px;
        padding: 5px 20px;
        color: white;
        background-color: rgba(0, 0, 0, 0.507);
        text-transform: uppercase;
        letter-spacing: 5px;
    }

    .shop-sec-content:nth-of-type(2) .shop-sec-content-text span {
        font-size: 24px;
        font-weight: bold;
        letter-spacing: 0px;
    }
}
<div class="shop-sec">

    <div class="shop-sec-content">
        <div class="shop-sec-text">HELLO</div>
    </div>

    <div class="shop-sec-content">
        <div class="shop-sec-content-text">NEW!<br><span>HELLO</span></div>
        <img src="">
    </div>

    <div class="shop-sec-content">
        <div class="shop-sec-content-text"></div>
        <img src="">
    </div>

    <div class="shop-sec-content">
        <div class="shop-sec-text">01</div>
    </div>

</div>

0 个答案:

没有答案