CSS media queries fail to accurately detect the screen size of the device

I am currently developing a mobile web application and have implemented a media query to specifically target phones with a screen height lower than that of the iPhone X+ (812px):

@media (max-height: 811px) {

}

While this media query works flawlessly on iOS devices, I encountered an issue when testing the app on a Huawei P30 Pro. Despite the Huawei device having a larger screen size than the iPhone X, it still triggered the media query, displaying a viewport height of only 755px.

How is it possible for the Huawei phone, with a larger screen, to have a smaller viewport height?

What steps can I take to effectively target only phones with physically smaller screens than the iPhone X?

Answer №1

If you're looking to address the issue, consider tweaking your index.html file - it could be the source of the problem.

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

Alternatively, adjusting your CSS settings might do the trick:

@media screen and (max-device-height: 811px) {

}

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

My Android app is experiencing difficulties retrieving JSON data from the server

Why is the code not retrieving JSON data in Android, even though the browser displays it correctly? The PHP code works fine but the Android app returns null when trying to fetch the data. protected void onCreate(Bundle savedInstanceState) { super.onCr ...

Why are multiple identifiers necessary in an iOS launch storyboard featuring only a basic centered image?

My current iOS launch storyboard code is quite verbose and includes unnecessary IDs and elements. The main purpose of this code is to display an image in the center. <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="com.apple ...

Utilizing Android's advanced feature of overlapping buttons to create multiple states

I'm currently developing a Piano app for Android. In my XML layout, I have created two rectangular buttons representing white and black keys. The challenge I'm facing is getting the black key to overlap the two white keys, similar to how a real p ...

MUI: Issue with pseudo element appearing cropped outside of Paper container

I am facing an issue where a red arrow pseudo element '::before' is partially cut off outside its container '.MuiPaper-root'. I need the arrow to remain visible, any suggestions on how to fix this? Here is the relevant code snippet and ...

Transitioning from a CSS box-shadow effect to an inset-box shadow on hover

Have you ever encountered the challenge of transitioning from a normal box-shadow to an inset box-shadow? I'm curious if this is the reason why my transition isn't working, or if there's another issue with my code. What steps should I take i ...

Animate the height change of every UITableViewCell without losing the current scroll position

I am interested in a solution that allows me to expand or collapse all cells in a UITableView without changing the current scroll position and with smooth animated height changes. The goal is for it to appear as though the visible cells are expanding or co ...

Modify the div's background color specifically with AngularJS

After creating a list using divs, my goal is to modify only the background color of the selected div when a user makes a choice from the list. I have accomplished this by defining two distinct CSS classes with the main difference being the background colo ...

Update the Bootstrap CSS styling of a button element following a user's click action

I am currently working with Bootstrap and facing an issue where I am trying to change the button color, but after clicking it and moving the mouse away, the color reverts back to blue. Here is the color I initially selected: https://i.sstatic.net/DCMq5.p ...

Having issues with the presentation of full_numbers pagination in IE while using jQuery dataTables

I am currently utilizing the DataTables jQuery plugin (found at ) with the initialization code below: $('#reconcile_table').dataTable( { 'bSort' : true, 'bFilter' : true, 'bSortClasses' : false, &a ...

What is the best way to determine the value of margin-left in inline CSS using jQuery?

Here is the code snippet I am working with: <div class="ongoing" style="width: +728px; margin-left: +12480px"> I need to extract the value of the margin-left property for scrolling purposes. The technique I used to retrieve the width value does no ...

`Issues encountered with resizing the menu``

Looking to create a unique restaurant horizontal list bar for my application. The goal is to have a horizontal menu that displays 3 options on the screen at a time, with the middle one being the largest and the two flanking it smaller in size. As I scroll ...

Tips for designing rainbow-themed elements (hyperlinks) using CSS to incorporate multiple colors

When customizing link styles in D3.js, it's common to adjust the color of the links. For instance, in the code snippet below, I've created thick links with a width of 10 and colored them grey. link = svg.append("g") . . . .style("stroke", "grey" ...

When I switch to smaller devices, the content in my div gets covered by the following div

I'm struggling with my bootstrap setup. When I switch to small devices, my content overlaps with the next div. I've tried adjusting margins and positioning, but nothing seems to solve the issue. I suspect it has something to do with the relative ...

Tips for incorporating inline images with gatsby-image

Seeking Solution In my quest to query and showcase images with a maximum width of 350px, I am hoping to have them displayed inline-block for tablets and larger screens. Ideally, each image would sit next to one another and wrap if they exceed the parent d ...

Steps to reveal a child element when the parent is set to overflow:hidden

There seems to be an issue with a child element having overflow:visible; while the parent element has overflow:hidden;. The height of the child element exceeds that of the parent element. Why is the child element hidden even when its overflow property is ...

Tips for utilizing ImageJ on an Android device

As I work on creating an Android app, my goal is to recreate the mapir plugin found in Fiji. After searching online, it seems that ImageJ2 could be a helpful tool for this task. How can I integrate ImageJ2 into my Android project? Also, are ImageJ2 and I ...

Touch websites are catered to with a JSF-centric framework

Can anyone recommend a JSF based framework that is ideal for creating websites specifically optimized for touch smartphones like Android? Appreciate any suggestions in advance. ...

ListView in ListActivity Fails to Display Any Entries

I've encountered a recurring issue for which I haven't found a suitable solution among the existing options. My Activity extends a ListActivity and contains the following code: super.onCreate(savedInstanceState); db = SQLiteDatabase ...

Significant empty space to the left of content due to Zurb Foundation

I'm currently utilizing Zurb Foundation within a rails project. My goal is to structure a basic page that consists of a table, text field, and a couple of buttons. However, I am facing a significant gap on the left side of my content, causing the rig ...

I am looking to capture the names of the checkboxes that have been selected and save them in a SQLite database

I am looking to design a personalized list view with checkboxes included. I need the ability to retrieve the names of the checkboxes that are clicked and save them in a SQLite database. Can someone provide guidance on how to solve this problem? ...