2016-01-13 3 views
1

HTML код: Как выбрать несколько классов внутри двух классов условий?

<html class="mobile portrait"> 
    <body> 
     <div> 
      <header> 
       <img class="company_logo"> 
      </header> 
      <section> 
       <div> 
        <img class="company_logo"> 
       </div> 
      </section> 
      <footer> 
       <img class="company_logo"> 
      </footer> 
     </div> 
    </body> 
</html> 

Для display: none;, Как я могу применить одно правило .company_logo в то время как .mobile .portrait:


Update: Edited HTML код для добавления нескольких company_logo. Код удален от вопроса:

/* CSS code */ 
.mobile .portrait > body > div > header > .company_logo { 
    display: none; 
} 
+0

'.mobile.portrait .company_logo'? Это говорит, что найти элемент с классом 'company_logo', который находится внутри элемента с обоими классами« mobile, portrait » –

+1

BTW, он должен быть« .mobile.portrait> .... »(без пробела) –

+1

Что @JuanMendes сказал без пробелов между '.mobile' и' .portrait', так как они находятся на одном и том же теге. '.mobile.portrait .company_logo' –

ответ

4
/* Matches elements with the class of company_logo that are 
    inside an element with both "mobile" and "portrait" classes */ 
.mobile.portrait .company_logo { 
    /* style here */ 
} 
+0

Я обновляю вопрос. – quantme

Смежные вопросы