The appearance of web viewing differs from that of mobile browsing

While developing, I am using the Chrome engine. Everything looks good on the web version, but when viewed on an actual device with Chrome or other browsers like Firefox, it appears differently.

Check out this image showcasing the behavior: https://gyazo.com/1d0cab6f0467c72e3cd4d64dc

The left side shows the view from my desktop while the right side is from my device.

body {
  margin: 0;
  display: flex;
  height: 100vh;
  overflow: hidden;
}
main {
  overflow: auto;
  height: calc(100% - 112px);
  background: red;
}
.navigation {
  height: 56px;
  position: fixed;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  background-color: #fff;
  z-index: 6;
}

Can anyone shed some light on why this is happening?

Many thanks in advance!

Answer №1

The reason for this issue might be due to the use of pixel values. Consider using percentages or rems instead.

Answer №2

The issue arises from the use of vh units.
The vh value varies on mobile versions, but I resolved this by dynamically calculating the vh using JavaScript. For more details, you can refer to this link: CSS3 100vh not consistent in mobile browsers

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

Obtain the complete source code by using the responseText property of the XMLHttpRequest object

I am looking to retrieve the entire source code of a webpage, such as www.google.com. Currently, I have a PHP file that can copy the source code of a page: <?php echo file_get_contents('http://www.google.com'); ?> Here is my function ...

When toggling the menu in bootstrap, the functionality of <a href=""> links may be disrupted

My attempt to integrate a toggle function into each link in the menu to automatically close the menu on mobile after selecting a link has hit a snag. With the solution of adding data-toggle="collapse" data-target="#navbarSupportedContent" to the <a href ...

When hovering over an image, another image is revealed

<div> <a href="#"><img src="images/Informasjon_button.png" width="120px" height="120px" /></a> </div> <div> <a href="#"><img src="images/Mail_button.png" width="120px" height="120px" /></a> </div ...

Utilizing Google Maps to generate outcomes for an online platform

My approach with Google Maps is a bit unconventional. Instead of rendering images, I aim to execute JavaScript code that processes data and returns a text response. However, I soon realized that running JavaScript as a remote web service might not be pos ...

JavaScript 12-hour Clock Displaying 24-hour Format with AM/PM Error

I am using JavaScript to display a 12-hour digital clock that updates continuously. However, the code I found online resulted in a 24-hour clock and incorrect am/pm output. Currently, it displays 13:33 am. I have experimented with various code snippets, in ...

Positioning JQuery tooltips

I've been developing a simple tooltip tool (check out the fiddle link below), but I'm encountering some issues with positioning. My goal is to have the tooltip appear centered and above the clicked link, however right now it appears at the top le ...

Displaying WordPress plugin queries in a linked file

I have been working on developing a custom WordPress plugin that involves querying a database based on user input and then displaying the results in an HTML file with links. While I have managed to successfully display the HTML page, I am facing an issue w ...

Each characterHas its own line

Is there a way to display all text in a div vertically, with one character per line and centered, without using a fixed width? I have achieved this layout by giving the div a fixed width of width: 7%; and using word-break: break-all; Would it be possible ...

Creating a custom front page in WordPress with a custom post type post

After using the CPT UI plugin in WordPress to create a custom post type, I am now facing the issue of not being able to display these posts on the front page by setting the 'reading' option in the admin panel. How can I go about displaying them p ...

Reaching out to the Edge: Enhancing the jQuery Slider Experience

Alright, I'm really excited about using this amazing slider. What I love most is the "free mode" feature that creates this stunning sliding effect. The size and number of slides are absolutely perfect for me. But there's just one small adjustment ...

Change the navbar brand in Bootstrap to be hidden on small screens like mobile devices

I am facing an issue with the navbar on my website where it expands in height when viewed on mobile devices due to not fitting into a single line. I have observed that if I remove the brand, it fits perfectly. However, I want to keep the brand visible on l ...

Ways to adjust the position of a DIV based on its index value

I'm currently working on a unique project that involves creating a triangular grid using HTML and CSS. The challenge I am facing is offsetting each triangle in the grid to the left by increasing amounts so they fit seamlessly next to one another. Righ ...

CSS file from outside does not impact the appearance of buttons

Take for instance this button: <input class="btn btn-primary btn-block btn-lg register_btn rounded-0 submit-button" type="submit" value="Submit"> and the CSS code within a custom custom.css file: .submit-button { ...

Is it important to maintain the scroll to top button at a consistent height?

I am facing an issue with my button. I want the button to remain at a consistent height even when the window size is adjusted vertically. How can I ensure that the button does not move or get pushed down as the height changes? http://jsfiddle.net/ccq9cs9L ...

The issue is with the ev.preventDefault() function not functioning properly in the Ajax image upload

I have noticed that when I upload an image, it redirects to UploadImage.cshtml. It seems that ev.preventDefault is not functioning as expected. Is there a way to solve this issue without delving into blueimp or xhtml because I am not quite prepared to work ...

DomSanitizer in Angular is not able to bind to an Angular component

Trying to dynamically insert HTML content into a DIV has been successful when done statically. The following code is functioning properly: <popover-content #pop1 title="Cool Popover" placement="right" ...

I am interested in updating the color of the navigation bar displayed on this website

I am having some trouble with manipulating the appearance of - Specifically, I'm struggling to change the color of the black bar at the top to blue. I have scoured the CSS files and examined the HTML, but I can't seem to locate the relevant code ...

Support for these CSS properties of left: 0; and right: 0; are compatible with

Just wondering if it's okay to utilize the CSS code below to ensure the element adjusts to its parent's width. .element { position: absolute; left: 0; right: 0; background-color: #ccc; border-top: 1px solid #ddd; } We don&ap ...

Explain the usage of bootstrap col-md-** without resorting to inline styling

Consider the example below <html> <head> </head> <body> <div class="col-xs-12 col-sm-12 offset-md-4 col-md-4 offset-lg-4 col-lg-4"></div> <div class="col-xs-12 col-sm-12 offset-md-4 col-md-4 offset-lg-4 col-lg- ...

Access the original source code using jQuery

Is there a way to retrieve the raw HTML code (as seen in Chrome's source code window) using JQuery without having quotes converted to &quot or HTML symbols converted to text? I have tried using html() and text(), but neither method seemed to give ...