CSS media queries issue










-1















Hey everyone i'm currently struggling with media queries in my website. I need to build a website that changes certain things according to screen size of the device.



I have copied the media query from the internet and added the Meta view-port. My friend has the exact same thing and there it works fine. I've added some code as reference. This should just work right?



Could someone tell me why it doesn't?



/*Mobile media query*/
@media only screen and (max-width: 360px)
.blue_box2
display:none;




My HTML viewport:



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









share|improve this question
























  • Questions seeking code help must include the shortest code necessary to reproduce it in the question itself preferably in a Stack Snippet. See How to create a Minimal, Complete, and Verifiable example

    – Paulie_D
    Nov 13 '18 at 16:33











  • Hello and welcome to SO! What is not working? Note that the viewport has to be below 360px for you to see this change. My Google Chrome instance only lets me shrink the viewport down to 418px so it is possible you may not be able to see this change take effect on a desktop browser...

    – War10ck
    Nov 13 '18 at 16:36
















-1















Hey everyone i'm currently struggling with media queries in my website. I need to build a website that changes certain things according to screen size of the device.



I have copied the media query from the internet and added the Meta view-port. My friend has the exact same thing and there it works fine. I've added some code as reference. This should just work right?



Could someone tell me why it doesn't?



/*Mobile media query*/
@media only screen and (max-width: 360px)
.blue_box2
display:none;




My HTML viewport:



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









share|improve this question
























  • Questions seeking code help must include the shortest code necessary to reproduce it in the question itself preferably in a Stack Snippet. See How to create a Minimal, Complete, and Verifiable example

    – Paulie_D
    Nov 13 '18 at 16:33











  • Hello and welcome to SO! What is not working? Note that the viewport has to be below 360px for you to see this change. My Google Chrome instance only lets me shrink the viewport down to 418px so it is possible you may not be able to see this change take effect on a desktop browser...

    – War10ck
    Nov 13 '18 at 16:36














-1












-1








-1








Hey everyone i'm currently struggling with media queries in my website. I need to build a website that changes certain things according to screen size of the device.



I have copied the media query from the internet and added the Meta view-port. My friend has the exact same thing and there it works fine. I've added some code as reference. This should just work right?



Could someone tell me why it doesn't?



/*Mobile media query*/
@media only screen and (max-width: 360px)
.blue_box2
display:none;




My HTML viewport:



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









share|improve this question
















Hey everyone i'm currently struggling with media queries in my website. I need to build a website that changes certain things according to screen size of the device.



I have copied the media query from the internet and added the Meta view-port. My friend has the exact same thing and there it works fine. I've added some code as reference. This should just work right?



Could someone tell me why it doesn't?



/*Mobile media query*/
@media only screen and (max-width: 360px)
.blue_box2
display:none;




My HTML viewport:



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






css media-queries






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 16:33









Paulie_D

73.9k96286




73.9k96286










asked Nov 13 '18 at 16:30









L.KrolL.Krol

31




31












  • Questions seeking code help must include the shortest code necessary to reproduce it in the question itself preferably in a Stack Snippet. See How to create a Minimal, Complete, and Verifiable example

    – Paulie_D
    Nov 13 '18 at 16:33











  • Hello and welcome to SO! What is not working? Note that the viewport has to be below 360px for you to see this change. My Google Chrome instance only lets me shrink the viewport down to 418px so it is possible you may not be able to see this change take effect on a desktop browser...

    – War10ck
    Nov 13 '18 at 16:36


















  • Questions seeking code help must include the shortest code necessary to reproduce it in the question itself preferably in a Stack Snippet. See How to create a Minimal, Complete, and Verifiable example

    – Paulie_D
    Nov 13 '18 at 16:33











  • Hello and welcome to SO! What is not working? Note that the viewport has to be below 360px for you to see this change. My Google Chrome instance only lets me shrink the viewport down to 418px so it is possible you may not be able to see this change take effect on a desktop browser...

    – War10ck
    Nov 13 '18 at 16:36

















Questions seeking code help must include the shortest code necessary to reproduce it in the question itself preferably in a Stack Snippet. See How to create a Minimal, Complete, and Verifiable example

– Paulie_D
Nov 13 '18 at 16:33





Questions seeking code help must include the shortest code necessary to reproduce it in the question itself preferably in a Stack Snippet. See How to create a Minimal, Complete, and Verifiable example

– Paulie_D
Nov 13 '18 at 16:33













Hello and welcome to SO! What is not working? Note that the viewport has to be below 360px for you to see this change. My Google Chrome instance only lets me shrink the viewport down to 418px so it is possible you may not be able to see this change take effect on a desktop browser...

– War10ck
Nov 13 '18 at 16:36






Hello and welcome to SO! What is not working? Note that the viewport has to be below 360px for you to see this change. My Google Chrome instance only lets me shrink the viewport down to 418px so it is possible you may not be able to see this change take effect on a desktop browser...

– War10ck
Nov 13 '18 at 16:36













2 Answers
2






active

oldest

votes


















-1














Have you got any conflicting code outside of this media query (or any inline styles in your HTML) that could cause it to function incorrectly?



The query you've shown works fine, which leads me to believe it's a problem with the code you haven't shown.



HTML



<div class="blue_box2" style="width:200px; height:200px;">
</div>


CSS



.blue_box2 background:red; 

@media only screen and (max-width: 360px)
.blue_box2
background:blue;




Just a thought:
Are you testing this using Google Chromes Developer Tools (F12), as just shrinking your browser window down normally may not reach as low as 360px.






share|improve this answer

























  • This is really a comment, not an answer. I appreciate that you may not yet have sufficient reputation to leave comments but please do not use the answer system as a replacement. Gaining reputation is fairly easy and only requires a little effort on your part. Thanks!

    – Paulie_D
    Nov 13 '18 at 16:41


















0














Have you tried the following?:



@media only screen and (max-width: 360px) 
.blue_box2
display:none !important;




or this :



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


My view port wouldn't work unless i put 1.0. Just wondering if the same is happening to you.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285468%2fcss-media-queries-issue%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    -1














    Have you got any conflicting code outside of this media query (or any inline styles in your HTML) that could cause it to function incorrectly?



    The query you've shown works fine, which leads me to believe it's a problem with the code you haven't shown.



    HTML



    <div class="blue_box2" style="width:200px; height:200px;">
    </div>


    CSS



    .blue_box2 background:red; 

    @media only screen and (max-width: 360px)
    .blue_box2
    background:blue;




    Just a thought:
    Are you testing this using Google Chromes Developer Tools (F12), as just shrinking your browser window down normally may not reach as low as 360px.






    share|improve this answer

























    • This is really a comment, not an answer. I appreciate that you may not yet have sufficient reputation to leave comments but please do not use the answer system as a replacement. Gaining reputation is fairly easy and only requires a little effort on your part. Thanks!

      – Paulie_D
      Nov 13 '18 at 16:41















    -1














    Have you got any conflicting code outside of this media query (or any inline styles in your HTML) that could cause it to function incorrectly?



    The query you've shown works fine, which leads me to believe it's a problem with the code you haven't shown.



    HTML



    <div class="blue_box2" style="width:200px; height:200px;">
    </div>


    CSS



    .blue_box2 background:red; 

    @media only screen and (max-width: 360px)
    .blue_box2
    background:blue;




    Just a thought:
    Are you testing this using Google Chromes Developer Tools (F12), as just shrinking your browser window down normally may not reach as low as 360px.






    share|improve this answer

























    • This is really a comment, not an answer. I appreciate that you may not yet have sufficient reputation to leave comments but please do not use the answer system as a replacement. Gaining reputation is fairly easy and only requires a little effort on your part. Thanks!

      – Paulie_D
      Nov 13 '18 at 16:41













    -1












    -1








    -1







    Have you got any conflicting code outside of this media query (or any inline styles in your HTML) that could cause it to function incorrectly?



    The query you've shown works fine, which leads me to believe it's a problem with the code you haven't shown.



    HTML



    <div class="blue_box2" style="width:200px; height:200px;">
    </div>


    CSS



    .blue_box2 background:red; 

    @media only screen and (max-width: 360px)
    .blue_box2
    background:blue;




    Just a thought:
    Are you testing this using Google Chromes Developer Tools (F12), as just shrinking your browser window down normally may not reach as low as 360px.






    share|improve this answer















    Have you got any conflicting code outside of this media query (or any inline styles in your HTML) that could cause it to function incorrectly?



    The query you've shown works fine, which leads me to believe it's a problem with the code you haven't shown.



    HTML



    <div class="blue_box2" style="width:200px; height:200px;">
    </div>


    CSS



    .blue_box2 background:red; 

    @media only screen and (max-width: 360px)
    .blue_box2
    background:blue;




    Just a thought:
    Are you testing this using Google Chromes Developer Tools (F12), as just shrinking your browser window down normally may not reach as low as 360px.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 13 '18 at 16:42

























    answered Nov 13 '18 at 16:39









    Matt.Hamer5Matt.Hamer5

    505




    505












    • This is really a comment, not an answer. I appreciate that you may not yet have sufficient reputation to leave comments but please do not use the answer system as a replacement. Gaining reputation is fairly easy and only requires a little effort on your part. Thanks!

      – Paulie_D
      Nov 13 '18 at 16:41

















    • This is really a comment, not an answer. I appreciate that you may not yet have sufficient reputation to leave comments but please do not use the answer system as a replacement. Gaining reputation is fairly easy and only requires a little effort on your part. Thanks!

      – Paulie_D
      Nov 13 '18 at 16:41
















    This is really a comment, not an answer. I appreciate that you may not yet have sufficient reputation to leave comments but please do not use the answer system as a replacement. Gaining reputation is fairly easy and only requires a little effort on your part. Thanks!

    – Paulie_D
    Nov 13 '18 at 16:41





    This is really a comment, not an answer. I appreciate that you may not yet have sufficient reputation to leave comments but please do not use the answer system as a replacement. Gaining reputation is fairly easy and only requires a little effort on your part. Thanks!

    – Paulie_D
    Nov 13 '18 at 16:41













    0














    Have you tried the following?:



    @media only screen and (max-width: 360px) 
    .blue_box2
    display:none !important;




    or this :



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


    My view port wouldn't work unless i put 1.0. Just wondering if the same is happening to you.






    share|improve this answer



























      0














      Have you tried the following?:



      @media only screen and (max-width: 360px) 
      .blue_box2
      display:none !important;




      or this :



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


      My view port wouldn't work unless i put 1.0. Just wondering if the same is happening to you.






      share|improve this answer

























        0












        0








        0







        Have you tried the following?:



        @media only screen and (max-width: 360px) 
        .blue_box2
        display:none !important;




        or this :



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


        My view port wouldn't work unless i put 1.0. Just wondering if the same is happening to you.






        share|improve this answer













        Have you tried the following?:



        @media only screen and (max-width: 360px) 
        .blue_box2
        display:none !important;




        or this :



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


        My view port wouldn't work unless i put 1.0. Just wondering if the same is happening to you.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 16:42









        K. MayersK. Mayers

        13




        13



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285468%2fcss-media-queries-issue%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            政党

            天津地下鉄3号線