N
N
nikoosya2020-04-13 15:21:56
css
nikoosya, 2020-04-13 15:21:56

@media attribute not working?

Hello. Styles do not work through the media attribute for the block. Everything works fine for other blocks, but not for .header. Here is the html:

<div class="header">
    <div class="container">
      <div class="header__content">
        <div class="row">
          <div class="text col-xl-5">
            <h2 class="title">Никита Шелудько</h2>
            <h3 class="title">Никита Шелудько</h2>
            <p class="subtitle">Веб-разработчик, верстальщик, веб-дизайнер</p>
          </div>
          <img src="img/me.png" alt="" >
        </div>
      </div>
    </div>
  </div>


css:
@media screen and (max-width: 840px) {
  .header{
    background:red;
                 .header__content{
    .text{
                font-size: 2em;
                }
          }
                }

If anything, I write in Scss. Tell me, what's the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arseny, 2020-04-13
Matytsyn @ArsenyMatytsyn

Wrap media in .header.

.header {
   @media (max-width: 840px) {
      /*стили для header*/

The compiler will assemble it the way it should.
I’m not sure about the syntax, I write in Sass, I haven’t worked with SCSS for a couple of years.

D
drawnofmymind, 2020-04-13
@drawnofmymind

1 well, obviously something with indents
2 Sass is written without brackets, did you mean scss?
try to refer to &__content
Well, it immediately caught my eye
, there is not enough closing curly brace

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question