R
R
RealL_HarDCorE2014-09-21 22:24:55
css
RealL_HarDCorE, 2014-09-21 22:24:55

How to set the style of an object in CSS, which will be applied when a media query is executed or if the parent object has a defined. class?

Friends, hello!
Here is the style that will be applied to the object if the window width is between 700 and 1000 px.

@media (max-width: 1000px) and (min-width: 700px) {
    .selector1 {
        color: #000;
    }
}

But I need this style to be applied to an object with the selector1 class also if any of the parent objects has the .example_class class. That is, something like this:
.example_class .selector1 {
    color: #000;
}
@media (max-width: 1000px) and (min-width: 700px) {
    .selector1 {
        color: #000;
    }
}

In this case, the style is duplicated, and this is not good.
How to combine these two conditions?
Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2014-09-21
@ReaL_HarDCorE

Use less/sass

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question