PC media query not functioning as expected

At first, my media query was working perfectly fine. However, it suddenly stopped working. Interestingly, when I use the browser's developer tool, the media query functions correctly. https://i.sstatic.net/w8AMQ.png

https://i.sstatic.net/Srnsi.png

Even though I believe that there's no error in my media query code, here it is:

@media only screen and (max-width: 760px) and (max-device-width: 760px) {
    .conainerInp {
        display: block !important;
    }
    .contInputs,
    .contInputs3 {
        flex: 100% !important;
        max-width: 100% !important;
        margin-bottom: 10px;
        width: 100%;
    }
    .last {
        margin-bottom: 60px;
    }
    .contenido {
        display: flex !important;
        flex-wrap: wrap !important;
    }
    .contenedoresGen {
        max-width: 100% !important;
        width: 100% !important;
    }
     ::ng-deep .mat-horizontal-content-container {
        padding: 0 !important;
    }
     ::ng-deep.mat-horizontal-stepper-content {
        overflow: auto !important;
    }
     ::ng-deep .mat-tab-label-container {
        overflow-x: auto !important;
    }
}

The issue occurred when the screen size was smaller than what was specified in the media query. https://i.sstatic.net/61JDk.png

Answer №1

To properly optimize your website for mobile devices, make sure to insert this meta element within the head section of your HTML document:

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

Answer №2

After some investigation, I discovered the root cause of the issue. It turned out that my conditions were too specific - requiring the screen to be exactly 760px in width and the device to match this as well. Despite having the necessary meta tag in place beforehand, the fix was actually quite simple: removing the following line of code

and (max-device-width: 760px) 

Surprisingly, the solution worked seamlessly on mobile devices thanks to the meta tag being properly utilized.

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

Use the .htaccess file to redirect any non-existing page to a custom HTML page while maintaining the

I am trying to set up a custom error page (error-404.html) for non-existing files and directories on my website. The goal is to seamlessly redirect users to the error page without changing the URL that they entered. RewriteCond %{REQUEST_FILENAME} !-f Rew ...

Creating a loading spinner with the help of an rxjs BehaviorSubject

After creating a loading spinner component for my angular 4 application to display during AJAX calls, I encountered an issue when trying to implement it with a subscription to a BehaviorSubject. This question is similar to how to show a spinner until data ...

The ngOnInit function is encountering undefined results from two separate subscriptions

Within my ngOnInit() function, I have two subscriptions. The result of the first subscription is utilized in the second one as shown below: ngOnInit() { this.Context.state$.subscribe((site) => { this._siteId = site.id; }); this.Summa ...

Do you think it's essential to subscribe and unsubscribe from observables in these scenarios?

Contemplating observables has brought me to consider the following scenarios: Scenario 1) In my use of NGRX, I diligently set up the architecture and create a selector service for a specific store. In this service, the absence of ngOnDestroy raises a que ...

Is there a way to prevent special characters from being typed without affecting the arrow keys?

To allow input of numbers from 0 to 9 as well as navigation keys such as up, down, left, right, delete, tab, home, and end, including modifier keys like alt and ctrl, this code is compatible with Chrome and Firefox browsers. $('.commonNumber').k ...

Customize attributes for dynamic elements

Is there a way to assign attributes to dynamically added buttons independently? I've encountered an issue where changing one attribute binds all button types together. My goal is to assign {type:Submit} to the first button, {type:Reset} to the second ...

Achieving Text Wrapping Around Unconventional Shapes Using CSS

I'm currently facing a challenge in getting text to wrap around an irregular shape on a web page. Despite numerous attempts, I have yet to find a solution that meets my requirements. Attached is an image illustrating the layout I am aiming for. The ...

Extract data from selected range using Highcharts

I am working on implementing a Highchart in Angular and I have run into an issue with creating my own range selector dynamically using this.chart.update. Unfortunately, the error "undefined update not a function" keeps popping up. How can I troubleshoot ...

The background image in Internet Explorer's <td> element will only be visible where there is existing content

Greetings to all, this is my first time asking a question here. I am currently facing an issue with a cell's background image. Interestingly, it displays perfectly in Chrome and Firefox, but the problem arises when using Internet Explorer. In IE, th ...

What is the best way to create clickable dynamic HTML table data using jQuery?

I'm fairly new to this, but I've managed to successfully create an HTML table dynamically using jQuery. Below is the code that I used: Is there a way to make the table data (value.id) clickable so that it can redirect to a different page? $(d ...

Discover the interactive world of HTML5 Canvas on iPhone with exciting highlights triggered by touchstart or mousedown

The canvas changes to a darker color when touched and held, reverting back to normal when the touch is released. This effect is similar to how hyperlinks are highlighted on an iPhone, not like text selection. To implement this feature, I am using jQuery t ...

Switching image sources depending on CSS prefers-color-scheme: A guide

In my endeavor to incorporate the latest CSS prefers-color-scheme media query into my website, I encountered a challenge. I have an img (image) element featuring a very dark blue image, which clashes poorly with the new dark mode setting. Is there a simpl ...

The divs are causing the site to grow larger and are not lining up correctly

My problem arises from the challenge of aligning my sidebar and a table vertically. Despite attempting to use float: left on the table, it only expanded the site width without properly aligning them side by side within Bootstrap, CSS, and HTML constraints. ...

Node.js serves an Angular application without the need for additional JavaScript scripts

After developing an Angular application with a node.js server, I encountered an issue where the browser displayed the HTML code served by the server as text instead of rendering the web page correctly. This problem arose when I built the Angular project in ...

What is the method to utilize the Escape Key in Angular to dismiss a mat-dialog?

I am currently utilizing angular version 15.0 and I am interested in how to close a mat-dialog using two different methods. The first method involves clicking on one of the two buttons (submit / cancel) that are specified in the actions section of the dial ...

Adding a dynamic click event in HTML using IONIC 4

I've created a function using Regex to detect URL links and replace them with a span tag. The replacement process is working fine, but I'm facing an issue where when I include (click)="myFunction()" in the span, it doesn't recognize the cli ...

Tips for integrating a fully revamped design for social network share buttons

Is it possible to customize social network like buttons similar to the ones shown in the attached image? ...

A combination of Webpack CSS modules with Angular templates

I am currently trying to integrate webpack CSS modules into my angular/ionic project. I'm wondering if it's possible for the CSS module class definitions to be correctly appended to an external template instead of an inline template. When I embe ...

Various modules in the project need to have distinct GitHub origins, particularly in the case of Spring-Angular

My goal is to create a well-structured project with separate frontend and backend modules. Here is the initial project structure: https://i.stack.imgur.com/EghPA.png I have attempted this in various configurations before, but every time I try, git recogn ...

Substituting a JavaScript function with a UserStyle solution

I am currently working on customizing a UserStyle for Instapaper. Since the original UserStyle was created, Instapaper has implemented several JavaScript functions in their header that control page width and font styles. Below are the functions: ...