Davis Lisboa
Davis Lisboa

Reputation: 1

Media-Queries CSS does not work on mobile

I've created a web site using visual code. I do have to say that I am not an expert. I've set a CSS style to have a responsive web on mobile screens. All the style that I've described on the CSS media-queries after @media (max-width: 600px) applies when I shrink the screen but I can not see any of that code working when I visit my website on a mobile.

Here a post the code

@media (max-width: 600px){
    .wrapper {
        flex-direction: column;
        height: 100%; 
    }

   .wrapper .dropbtn{
        color: #336699;
        border: none;
        cursor: pointer;
        display: block;
        margin-bottom: 1px;
      }
    
    .wrapper .main_content .info{
        display: flex;
        flex-direction: column;
    }

    .wrapper .main_content .info .dropdown .dropdown-content{
        margin-bottom: auto;

    }

    .wrapper .main_content .social_media{
        position: relative;
        flex-direction: row;
        left: 48%;
    }
    .sidebar{
        display: none !important;
    }

    .wrapper .main_content{
        margin-left: 20px;
    }

    .wrapper .main_content .info {
        margin-left: 0px;
    }
}

Upvotes: 0

Views: 44

Answers (2)

Vikas Harad
Vikas Harad

Reputation: 452

enter code here

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <style>
    @media (max-width: 600px){
    .wrapper {
        flex-direction: column;
        height: 100%; 
    }

   .wrapper .dropbtn{
        color: #336699;
        border: none;
        cursor: pointer;
        display: block;
        margin-bottom: 1px;
      }
    
    .wrapper .main_content .info{
        display: flex;
        flex-direction: column;
    }

    .wrapper .main_content .info .dropdown .dropdown-content{
        margin-bottom: auto;

    }

    .wrapper .main_content .social_media{
        position: relative;
        flex-direction: row;
        left: 48%;
    }
    .sidebar{
        display: none !important;
    }

    .wrapper .main_content{
        margin-left: 20px;
    }

    .wrapper .main_content .info {
        margin-left: 0px;
    }
}</style>
</head>

<body>
    -------
    
    ---------

</body>
</html>

Upvotes: 1

Saisha
Saisha

Reputation: 94

Try adding this in the head section of your HTML document

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Upvotes: 1

Related Questions