.masthead { padding: 3em 3em; background-color: #0D1B2E; color: white; /*float:left;*/ margin: 0 auto; max-width: 550px; margin-right: 0px; } .masthead h1 { text-align: center; } .intro { padding: 2em 2em; color: #ffffff; background: #429890; /*float:right;*/ margin: 0 auto; max-width: 550px; margin-left: 0px; } .intro p { margin: 0 auto; max-width: 550px; } @media (min-device-width: 992px) and (max-device-width: 1199px) { .masthead { padding: 3em 3em; background-color: #0D1B2E; color: white; /*float:left;*/ margin: 0 auto; max-width: 550px; margin-bottom: 15px; } .intro { padding: 2em 2em; color: #ffffff; background: #429890; /*float:right;*/ margin: 0 auto; max-width: 550px; } } <div class="masthead"> <h1 class="header-type">Test Your Typing Speed</h1> </div> <article class="intro"> <p class="type">This is a typing test. Your goal is to duplicate the provided text, EXACTLY, in the field below. The timer starts when you start typing, and only stops when you match this text exactly. Good Luck!</p> </article> <!-- .intro --> The question is probably a stupid one, but I’m fighting it not for the first day. Created a layout, made media requests - when checking for them, the layout behaves adequately. However, if I just change the browser window (I also tried to match the size of media queries, the same story), then some blocks behave incorrectly. What is the reason that I do not take into account? If necessary, I can lay out the code, but I feel that I am missing some basic thing.