Tailwind custom classes are not being rendered on mobile devices and Chrome DevTools, however, they are functioning properly on desktops and Safari DevTools

During the development of my project using Tailwind CSS, I focused on desktop compatibility and ensured responsiveness with Safari and Google Chrome. However, upon switching to DevTools, I encountered issues that persisted when testing on mobile devices.

For instance, when viewing on an iPhone 7+, only the class h-vh70 seemed to be applied:

<div class="h-vh30 sm:h-vh50 md:h-vh70 w-screen flex justify-center items-end">
        <img src="./src/img/banner 1.png" alt="" />
</div>

A closer look at my tailwind.config.js file revealed the following adjustments:

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    //my html files
  ],
  theme: {
    extend: {
    height: {
        vh30: "30vh",
        vh50: "50vh",      
        vh70: "70vh",
      },
    },
  },
  plugins: [require("tailwindcss-textshadow"), require("autoprefixer")],
};

Answer №1

Adding

<meta name="viewport" content="width=device-width, initial-scale=1.0">
was the missing piece

Issue resolved!

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

Basic HTML Audio Player Featuring Several Customizable Variables

I have a unique API that manages music playback. Instead of playing audio in the browser, it is done through a Discord bot. Achievement Goal https://i.stack.imgur.com/w3WUJ.png Parameters: current: indicates the current position of the track (e.g. 2:3 ...

Decoupling the Top Navigation Bar from the Side Navigation Bar

I currently have a top navigation bar with some menus and a side navigation bar with additional menus. I have applied styling to the vertical navigation bar, but it seems to be affecting all the navigation bars, resulting in an output as shown in the image ...

Adjust the state based on the event in ReactJs

I have the following code snippet in a React JS application: const items = [ { value: "A", label: "A" }, { value: "B", label: "B" }, { value: "C", label: "C" }, { value: "D", label: "D" }, { value: " ...

Tips for exchanging divs in a mobile view using CSS

Illustrated below are three separate images depicting the status of my divs in desktop view, mobile view, and what I am aiming for in mobile view. 1. Current Status of Divs in Desktop View: HTML <div id="wrapper"> <div id="left-nav">rece ...

Floating elements are misaligned and not laying out correctly

I've encountered an issue where the footer div is appearing behind the right-hand side div. I have a central container div with two floated divs next to each other, and the footer is separate. I've spent hours trying to fix it but can't figu ...

Universal loading screen across all components

I am currently implementing a loading screen for this component in conjunction with the fetch method. My concern is whether I will need to replicate the same loading logic used in the example for every component that utilizes the fetch() method, or if the ...

Tips for Efficiently Navigating in NextJS Without Losing State in the Header Component

Is there a way to structure a next.js app for seamless navigation without resetting the state of the header component? Allow me to elaborate. Currently, I have a header component set up like so: import { useState } from "react" import Link fro ...

Animating with JavaScript

I have a members button on my website that triggers a dropdown animation when clicked. However, the issue is that the animation occurs every time a page is loaded, even if the button is not clicked. I want the dropdown to only open when the button is click ...

Is it possible to eliminate the border of an HTML element when clicked, while still keeping the border intact when the element is in

I am currently developing a project with an emphasis on Web accessibility. Snippet of Code: function removeBorder(){ li=document.getElementById("link"); li.classList.add(".remove") } body{ background:#dddddd; } p:focus{ border:1px solid red; } li{ ...

How can a variable be exported from a React component?

Is there a technique to export a variable from a React component for use in a custom hook? The code snippet is as follows:- function App() { const SignIn=()=>{ //Some code here var userId = data.info.username; //Some code h ...

When making a jQuery + AJAX request, IE8 is causing a null return value

I'm completely stumped as to why this issue is happening. To start, the code has been checked and validated by the W3C validator as HTML5, except for some URL encoding problems (such as & needing to be &amp;), but I don't have the ability ...

When using the POST method to modify data via an HTML form, the previous values may be

I am currently developing a CRUD system and focusing on the Update functionality. My task involves updating existing user data with new information submitted through an HTML form. At this stage, I am working on retrieving the POST values from the HTML for ...

Difficulty encountered while using MySQL column update button

I'm looking for assistance in updating my database using an SQL statement after a button is clicked on the website. I attempted something but it was unsuccessful. Could anyone provide guidance? Here's the code snippet: http://pastebin.com/D0S83Jg ...

Issue with Bootstrap 5 dropdown menu extending beyond the viewport on the right side

The user dropdown in my code is cut off, even though I'm using Bootstrap 5. I came across an older article on stackoverflow suggesting to add .dropdown-menu-left or .dropdown-menu-right to the </ul>, but that didn't solve the issue for me. ...

Tips for creating fonts that adjust depending on the length of characters

Is there a way to adjust the font size of a paragraph based on the space available in its containing div, depending on the length of characters? For instance: p{ font-size:15px; } <div class="caption"> <p>Lorem ipsum dolor sit amet, consect ...

What criteria does Next.js use to determine which component to display in a layout?

While I've mastered Angular, I'm currently tackling a simple demo in next.js. I can't wrap my head around how next.js (or React, technically) determines which component to display within a layout. Take this example: https://github.com/ver ...

Turn off animation for left-aligned floating label in Material-UI password input on ReactJS

Recently, I came across an input field with a toggle password visibility icon. However, the issue I encountered was the floating label animation effect that Material UI applies to inputs. I couldn't figure out how to remove this animation and make the ...

Styling CSS: Adjusting font sizes for placeholders and text boxes

I am struggling with styling an input field to have a font size of 45px while the placeholder text inside it should be 18px and vertically aligned in the middle. Unfortunately, my current code is not working in Chrome and Opera. Can anyone offer a solutio ...

The jQuery fade speed effect has a limitation where it can only be utilized

When a specific link is clicked, I want a div to display with a fadeIn effect and then fadeOut when the link is clicked again. However, after the first click following an HTTP request, the fadeIn works but the fadeOut does not (the div closes though). More ...

Scrolling Material-UI List items above an AppBar

Utilizing Material-UI (http://material-ui.com) for React.JS to develop a mobile application has presented a challenge. The issue lies in list items scrolling their content on top of the app bar. Conversely, other types of content (such as standard paragrap ...