Issue with responsive design: Media queries not applying max-width

GOAL

I want the content of my page to adjust to screen sizes that are smaller than 600px wide.

ISSUE

When using the responsive tool in Chrome, preset screen sizes like iPhone X do not apply media queries properly. Even manually adjusting the screen size does not trigger the media queries. The same problem occurs in Firefox with preset screen sizes, but manual resizing works as expected. Testing on a physical device like an iPhone 7 Plus also shows that media queries do not work as intended.

In my project, I am utilizing SCSS with mixins for media queries. While responsiveness is working on most pages, there is an issue specifically on the sign-in page. For this question, I have simplified it by providing a CSS-only version.

SOLUTION ATTEMPT

body {
  margin: 0;
  padding: 0;
}

html {
  /* 10px/16px = 62.5% -> 1rem = 10px */
  font-size: 62.5%;
}

/* phone screen breakpoint */
@media (max-width: 600px) {
  html {
    /* 1 rem = 7px, 7/16 = 43.75% */
    font-size: 43.75%;
  }
}

.container {
  background: black;

  margin: 0 auto;
  width: 100vw;
  height: 100vh;
}

.wrapper {
  max-width: 35rem;
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.8);
  box-sizing: border-box;
  right: 50%;
  bottom: 50%;
  transform: translate(50%,50%);
  position: absolute;
  padding: 5rem;
}

.wrapper h1 {
  color: black;
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
  padding-bottom: 2rem;
}

.wrapper form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.wrapper form input {
  width: 100%
  padding: .5rem;
  margin-bottom: 1rem;
}

.footer {
  position: absolute;
  bottom: 0;

  float: left;
  width: 100%;

  display: flex;
  justify-content: space-between;
}

.footer ul {
  float: left;
  margin-top: .5rem;
  width: 70vw;
}

.footer li {
  display: inline-block;
  border-right: .1rem solid white;
  padding: 0 1rem;
  margin-bottom: .5rem;
}

.footer li:last-child {
  border-right: none;
}

.footer li a {
  display: inline-block;
  color: white;
  font-size: 1rem;
  font-weight: 500;
}
<div class="container">

    <div class="wrapper">
      <h1>SIGN IN HERE</h1>
      <form>
        <input type="text" placeholder="E-mail">
        <input type="text" placeholder="Password">
        <button>Sign In</button>
      </form>
    </div>

    <div class="footer">
      <div>
        <ul>
          <li><a href="#">About</a></li>
          <li><a href="#">Terms</a></li>
          <li><a href="#">Policy</a></li>
        </ul>
      </div>
    </div>

  </div>

Answer №1

Your inputs are not resizing because you're missing a semicolon in your CSS code:

.wrapper form input {
  width: 100%; /* <- Don't forget the semicolon here */
  padding: .5rem;
  margin-bottom: 1rem;
}

For a visual reference, check out this image.

Moreover, your media query is functioning correctly. It's important to note that altering the font size of <input> and other form elements can be complex as they do not inherently inherit font properties. As suggested in this solution, you could apply the following snippet:

input, select, textarea, button { font-family: inherit }

Alternatively, you have the option to customize these properties for individual form elements based on your preference.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Incorporating hyperlinks within the navigation buttons

I'm working on a design where I have six buttons that need to be displayed on top of a background image. How can I ensure that the text inside the buttons stays contained within them? Here is the current code structure I am using, which involves utili ...

Guide to filling a dropdown menu by aligning with the text it contains?

I've set up two dropdown select boxes below that are exactly the same: HTML <select id="ddl1" name="ddl1"> <option value="1">TEXT 1</option> <option value="2">TEXT 2</option> <option value="3">TEXT 3&l ...

The stylesheet malfunctioned while attempting to load varying layouts in separate controllers

Hey, I encountered a strange issue. After clicking on the three pages displayed in the images below: Step 1 controller welcome Step 2 other controllers Step 3, back to step 1 view controller welcome The final image, when returning to controller welcom ...

Spring load without CSS

Upon successful login, I am redirected to my main site using the following controller: //Login Success @GetMapping("/login-success") public ModelAndView loginSuccess() { return new ModelAndView("/cont/home.html"); } The URL for this redirection i ...

Currently seeking assistance in replacing an existing Wordpress object with a new one

I'm looking to swap out the current slider image with a new slider. Whenever I try to replace it with the TOP 5 Games, they disappear or don't show up at all. <?php if( function_exists('cyclone_slider') ) cyclone_slider('24&ap ...

What is the best approach to reverse the selection of <li> elements by utilizing :not() and :contains

I am looking to implement a live search feature using jQuery. Below is the code snippet I have written: $("#searchInput").on("keyup", function () { var searchTerm = $("#searchInput").val(); $('li:contains("' + searchTerm + ' ...

What is the best way to adjust a map to completely fill the screen?

I am experiencing an issue with my Openlayer map not fitting to full screen automatically. Despite trying various settings, I am unable to resolve this issue. Can anyone suggest what might be causing this problem? Thank you in advance https://i.stack.imgu ...

Font Awesome icons displayed using the <i class="icon-ok"></i> markup are not styled correctly and do not respond to events in Chrome

I implemented Font-Awesome, an iconic font designed for use with Twitter Bootstrap. Here is the markup: <i class="icon-remove reset-preference-button"></i> And here is the CSS: .reset-preference-button { cursor: pointer; } For JavaScript f ...

Can I customize the color of an SVG image with CSS (jQuery SVG image substitution)?

This is my innovative solution for easily embedding and styling SVG images using CSS. Traditionally, accessing and manipulating SVG elements with CSS has been a challenge without the use of complex JS frameworks. My method simplifies this process, making ...

Locate the div in the array that includes ValueA, and save ValueB from it into a new variable

When the button is clicked, I retrieve the current value of a Select control using the following code... $('#myBtn').on('click', function (clickEvent) { var nameSelected = document.getElementById('mySelectControl').getEle ...

Separating a picture into distinct sections

Is there a way to divide an image into different parts to create hover effects? For example, hovering over the top part of the image triggers one change, and hovering over the bottom part triggers another change. This example demonstrates this concept usin ...

Creating a jQuery multiple image preview feature is a simple and effective way to

Looking to implement a single image upload preview function in jQuery? Want to modify it to allow for multiple image uploads with separate boxes? Check out the HTML script below. <!DOCTYPE html> <html> <head> <title></title> ...

extracting an attribute from a class's search functionality

Let's consider the following HTML structure: <div id="container"> <div> <div class="main" data-id="thisID"> </div> </div> </div> If I want to retrieve the value inside the data-id attribute ...

AngularJS: Issue with JQuery Slider not Updating Scope Value

I am currently working on a project using AngularJS and I have integrated a jQuery slider into it. However, I am facing an issue where I need to change the value of a select box which is defined in a $scope array, but the functionality is not working as ex ...

The container holding the inner elements is slightly oversized by a couple of pixels

Check out this Plunker example. Hello everyone, I am currently working on fitting two inner divs (a title bar and a canvas) inside an outer div. These inner divs are generated dynamically and have specific fixed dimensions. Below is a sample code snippet ...

Having issues with jQuery's .hover and .mouseleave functions causing unintentional looping. Any suggestions on how to resolve this

What I want to achieve: When hovering over the image, it fades out. Text should fade in after the image fades out. Text should fade out when the mouse leaves. The original image should fade back in. End with the original image and no text displayed. Iss ...

Populating Modal on open with jquery/javascript

I am trying to dynamically populate a Modal when it opens, but so far all my attempts using append have failed. Here is the code for my Modal: <div class="modal fade" id="ModalForAllUsers" tabindex="-1" role="dialog" aria-hidden="true"> <div ...

My HTML loop is functioning properly with a variable, however, it is not working as expected

Hi there! Here is a piece of code that includes a loop with a timer. I am trying to change a variable using a button, however, it's not working as expected. <!doctype html> <html> <body> <script> var timer = 1000; var counter ...

Turn off webpage caching in HTML5

I am looking for a way to disable the browser cache using HTML5. While I came across this helpful post (How to control web page caching, across all browsers?), it only provides information for HTML4 or other languages. In my web application, I utilize Ja ...

Can you identify the specific name of the IE CSS bug affecting double vertical padding?

(Just when I thought I've encountered all the strange IE CSS bugs, here comes another one. Is there a name for this double-vertical-padding bug?) After creating a simple test case that worked perfectly in browsers like FF and Opera, I was surprised t ...