Responsive css does not work properly

Asked

Viewed 537 times

0

I’m having a problem where I’m making a responsive display where the desktop is getting over @MEDIA SCREEN and on mobile is not getting the responsive.

.portfolio-modal .close-modal {
position: absolute;
right: 25px;
width: 180px;
top: 5px;
height: 75px;
background-color: transparent;
    cursor: pointer;
}

@media (max-width: 479px){
            .portfolio-modal .close-modal {
    width: 50px;
}
}
  • On the last 6 lines you are overwriting, media all includes midia screen, I suggest you read this MDN content talking about Media Query https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/CSS_Media_queries, Also take care of your formatting, after opening media you need to use {}

  • is that I’m finding it strange, because only this class is not getting the responsive the rest is.

  • This code will not work anyway, it is missing a } closing the first media and {} opening and closing the second...

  • was closed just forgot to put here at the end. I updated how the code is.

1 answer

1


The right thing would be

@media screen and (min-width: 480px) {
    body {
        background-color: lightgreen;
    }
}

Understood missed the '{' after the media, this serves to delimit what is part of the rule.

http://www.w3schools.com/css/css_rwd_mediaqueries.asp http://www.w3schools.com/cssref/css3_pr_mediaquery.asp

Auxiliary links to your study.


I made a test here and it worked the code, see:

<!DOCTYPE html>
<html>
<head>
    <title></title>

    <style>
    .teste {

       height: 100px;
       width: 180px;
       background-color: red;
    }

    @media (max-width: 479px){
        .teste {
            width: 50px;
        }
    }
    </style>
</head>
<body>
     <div class="teste"></div>
</body>
</html>

If it doesn’t work the other thing impacting on your css

  • didn’t work buddy, gave the same thing

  • update the css that is in your question, remembering that I have not passed a solution but an example of how it should be, ok

  • I updated there... I think it’s right but something is not taking.

  • try @media (max-width: 479px) {, take out the second media query it may also be causing you problems, leave only one, as shown.

  • updated friend, even so I’m not getting.

  • I edited my reply from a check

  • Yes now it worked thanks friend, only in HTML it gets ugly, but the important thing is to work THANK YOU.

  • Actually the problem was mediatype that was being omitted screen.

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.