سؤال

I am removing the box shadow CSS with my media query:

.myelements {
    @include box-shadow(2px 2px 3px #000);
}

@media (max-width: 768px) {
    .myelements {
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;
    }
}

Instead of re-defining the css as none and having to use all the vendor prefixes I was wondering if there was more elegant sassier way? I am using SASS and Compass.

هل كانت مفيدة؟

المحلول

The correct value is none:

.myelements {
    @include box-shadow(2px 2px 3px #000);
}

@media (max-width: 768px) {
    .myelements {
        @include box-shadow(none);
    }
}

However, you should avoid repeatedly setting/unsetting properties whenever possible to get a smaller CSS file:

.myelements {
    // nothing
}

@media (min-width: 768px) {
    .myelements {
        @include box-shadow(2px 2px 3px #000);
    }
}

نصائح أخرى

Make it transparent:

.myelements {
    @include box-shadow(2px 2px 3px #000);
}

@media (max-width: 768px) {
    @include box-shadow(0 0 0 0 rgba(0,0,0,0));
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top