Mobile devices experiencing text overflow problem

Experiencing trouble with the parallax effect on mobile devices, where it seems that the total body size exceeds 100vh, resulting in a visible scroll bar at the side. Changing overflow-y from auto to hidden resolves the issue but cuts out part of the page content as well. Interestingly, this problem does not occur on desktop browsers. Any assistance would be greatly appreciated.

Screenshot: https://i.sstatic.net/unhXH.jpg

.selector-for-some-widget {
  box-sizing: content-box;
}

header .carousel-item {
  height: 100vh;
  min-height: 350px;
  background: no-repeat center center scroll;
  -webkit-background-size: cover;
  background-size: cover;
}
... (omitted for brevity)
<!doctype html>
<html lang="en">

<head>
... (more HTML code follows)

Answer №1

Check out this fantastic solution: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/

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

// To start, we calculate the viewport height and multiply it by 1% to obtain a value for a vh unit
let vh = window.innerHeight * 0.01;
// Next, we assign this value to the --vh custom property in the root of the document
document.documentElement.style.setProperty('--vh', `${vh}px`);
body {
  background-color: #333;
}

.module {
  height: 100vh; /* Utilize vh as a fallback for browsers that don't support Custom Properties */
  height: calc(var(--vh, 1vh) * 100);
  margin: 0 auto;
  max-width: 30%;
}

.module__item {
  align-items: center;
  display: flex;
  height: 20%;
  justify-content: center;
}

.module__item:nth-child(odd) {
  background-color: #fff;
  color: #F73859;
}

.module__item:nth-child(even) {
  background-color: #F73859;
  color: #F1D08A;
}
<div class="module">
  <div class="module__item">20%</div>
  <div class="module__item">40%</div>
  <div class="module__item">60%</div>
  <div class="module__item">80%</div>
  <div class="module__item">100%</div>
</div>

Answer №2

Solution to Fixing 100vh Issue on Mobile Devices Using Pure CSS

At times, the vh unit is utilized to create sections that match the height of the viewport. This is especially common in the construction of landing pages. In such scenarios where position sticky is not effective, consider utilizing the fill-available property as an alternative. Implementation is straightforward, ensure to include prefixes and a fall-back value:

.container {
  min-height: 100vh;            /* fall-back */
  min-height: -moz-available;
  min-height: -webkit-fill-available;
  min-height: fill-available;
}

It's a simple fix!

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

SideBar does not display Bootstrap ToolTip

The sidebar's "Hover here" feature is not displaying the tooltip correctly: CodeSandbox However, if the bootstrap CSS is removed, it works fine: CodeSandbox I have identified the issue to be related to this particular property: .tooltip { positio ...

The locator for the span class cannot be found or interacted with in Selenium

Here is the HTML code snippet for a span element: <td class="header-logout-btn"> <a href="logout.htm" class="btn switch-btn"> <i class="fa fa-times"></i><span class="hidden-xs">Home</span> </a> </td> I ...

I'm looking to replicate the testimonial slider from the link provided. How can I achieve this?

I'm looking to replicate the testimonial section layout seen on Kanbanize, which features both vertical and horizontal sliders. I'm unsure of how to link the two sliders so they move in sync. I typically use Swiper for carousel/slider functionali ...

Did you stumble upon an unexpected JavaScript redirection?

I am facing an issue with my form where pressing enter redirects the URL instead of adding an item to a list, while clicking the submit button works fine. I'm not sure what caused this sudden change in behavior. Here is the HTML code snippet: <fo ...

Creating customized placeholders using CSS padding in HTML5

I came across this helpful post and attempted various methods to adjust the padding for my placeholder text, but unfortunately, it seems unwilling to cooperate. Below is the CSS code. (EDIT: This CSS was generated from SASS) #search { margin-top: 1px; ...

What steps do I need to take to design a menu?

I need assistance in organizing my menu with submenus. The code I currently have successfully retrieves all the submenus, but I would like to categorize them accordingly: For instance: Main Menu - Submenu 1, Submenu 2, Submenu 3 How can I go about categ ...

Trouble aligning two columns in a row with Bootstrap 4

Hey there! I've encountered an issue with my login form using bootstrap 4. I have set up two col-md-6 columns in a row for "Remember Me" and "Forgot Password", but on mobile devices, the "Forgot Password" section jumps down from the row. Can anyone sh ...

Utilizing nested flexboxes to create a horizontal row within a vertical column

As I work on creating a mock survey form, I've organized the input fields in a column flex-box layout. However, I'm facing an issue with the name field where I want to split it between 'first' and 'last' names while sharing th ...

Jquery unable to render UL or LI tags in HTML document

Here's a snippet of code I've been working on: //show live preview while typing $('#copyText').keyup(function(e){ $('#copyPreview').html($('#copyText').val()); }); Users can input HTML and see a real-time previ ...

Gradually Generated HTML website

Recently, I've been attempting to create a Sign-UP form using HTML and CSS in Notepad++, but I'm encountering a problem. Every time I try to test it on Chrome, the page loads incredibly slowly. I'm not sure if it's a configuration error ...

I need my styled component to make sure my inner div spans the entire width of its parent div

I'm having an issue with my NavDiv styled component not taking up the full height of my Wrapper styled component. I've tried setting the height using different units like percentage, em, rem, but it doesn't seem to work. It only works when u ...

The onKeyUp event is not functioning as expected in React, unlike the onChange event

For a React coding challenge, I am required to update a value onKeyUp instead of onChange. However, after changing it to onKeyUp, my fields are not updating and I cannot type anything into the textarea. class MarkdownApp extends React.Component { constr ...

The Alchemy feature on hover is not functioning

I am currently using alchemy.js to display a graph, but I am encountering issues with showing the "onMouseOver" caption of the graph's node. The console is displaying some errors which you can see here. Here is the code snippet: <html> < ...

Utilizing JavaScript and the Document Object Model (DOM) to display images within a

My main goal is to have images load dynamically as the background of the browser frame, without any white spaces or repeats. I've successfully achieved this statically, but now I want to implement it so that different images are generated randomly. W ...

The performance of the animation on http://responsive-nav.com/ becomes erratic when viewed on Android devices

Recently, I came across a fantastic plugin that works perfectly on regular computer browsers. However, when I tested it on my android phone, the css3 animation for the dropdown appeared choppy and seemed to be dropping frames. Does anyone have suggestions ...

What causes JavaScript image to stop loading while displaying a prompt dialog?

I have nearly finished my project. I will include a codepen link at the end of the post for debugging purposes. What Should Happen? The img element has an id property of dragon, and the image specified in the src attribute should be pre-loaded as the defa ...

Smooth transitions: How AJAX calls to PHP chats revolutionize page navigation

When I click the "send button," the page automatically scrolls to the top, which is not the expected behavior. Any suggestions on how to fix this? I've already tried using animations and return false, but nothing seems to be working. Check out the JSF ...

How come when I click on the edit button, the selected data's model doesn't appear in the dropdown menu as I would like it to?

this is the function in my controller public function getModel($make_id = null) { $make_id = request()->make_id; $carsmodel = CarModel::where('make_id', $make_id)->orderBy('model', 'ASC')->get(); return re ...

Choosing a single radio button is simple with these steps

Trying to display radio-buttons in the code below, but encountering an issue where all radio-buttons can be checked simultaneously. The desired functionality is to only allow one radio button to be checked at a time, preventing the selection of multiple op ...

Packaging an Angular project without the need for compiling

In order to enhance reusability, I structured my Angular 6 Project into multiple modules. These modules have a reference to a ui module that contains all the style sheets (SASS) as values such as: $primary-text-color: #dde7ff !default; Although this app ...