What could be causing only certain styles to not function properly on mobile devices?

I've scoured the depths of the internet but have come up empty-handed. On desktop and tablet views, my styling looks perfect. However, when it comes to mobile view, most elements are not styled correctly. I have double-checked that I added

<meta name="viewport" content="width=device-width, initial-scale=1">
in the head tag, and verified that the path to my CSS sheet is accurate (since other screen sizes display properly).

In Firefox Dev tools, I was able to make the desired changes, yet when I input the same values (within and outside a media query) they seem to have no effect. Upon saving and refreshing the page, the incorrect styling resurfaces.

If anyone has any suggestions on what I could do differently or add to my code to resolve this issue, I would greatly appreciate it. Thank you in advance.

UPDATE: Below is a snippet of my HTML along with the corresponding CSS.

h2 i {
  color: #fafafa;
}

.profile-text {
  padding: 100px;
}

.profile-text p {
  font-size: 18px;
}

.about {
  padding-top: 10px;
}

img {
  vertical-align: middle;
  border-style: none;
  width: 100%;
}

.photo {
  height: 50%;
  overflow: hidden;
}

.contact-info {
  background-color: #c158dc;
  text-align: center;
  color: #fafafa;
}

.contact-info .value {
  padding-left: 20px;
}

.value {
  margin-bottom: 10px;
  font-size: 18px;
}
<div class="row no-gutters">
  <div class="col-md-4 contact-info">
    <div class="photo">
      <img src="assets/images/bratislava-sm.JPG" alt="profile image">
    </div>
    <div class="upper value">
      <p>Amy H</p>
    </div>
    <div class="value">
      <p><i class="fas fa-map-marker-alt"></i> text here</p>
    </div>
    <div class="value">
      <p><i class="fas fa-phone-alt"></i> text here</p>
    </div>
    <div class="value">
      <p><i class="fas fa-envelope-open-text"></i> test here</p>
    </div>
  </div>

Answer №1

It's difficult to determine the issue without further information. Here are a few suggestions to troubleshoot:

  • Double-check that cachebusting is enabled and ensure your mobile device isn't displaying an outdated cached version of the page.
  • Try applying a noticeable style change, such as background: red;, to confirm that your edits are being implemented.
  • Use Chrome or Safari's remote device inspection tool to examine the page on your mobile device when it's connected to your computer via USB. You can access this feature at chrome://inspect.

Answer №2

During a discussion with my tutor, I discovered that the reason for my problems was a missing closing curly brace in a media query higher up in my CSS file. It's amazing how such a small oversight can cause so many issues.

If you're having trouble with the meta tag like I was, make sure to double-check all your curly braces to ensure they are properly closed.

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

Is there a way to ensure that the navigation bar only appears at the top of the page?

Is there a way to only show the navigation bar when a user scrolls to the very top of the page? Currently, the nav bar appears whenever the user scrolls up, regardless of the screen position. Html <header class="nav-down"> <div> navigation ...

What is the best way to create floating content over a fixed video using HTML?

On the webpage, there is a background video set with position: fixed. Below the video, there is a <div> containing the main content. How can I make this content float over the video? Check out my experimental page at oleg-s-fresh-site-8f277a.webfl ...

Having issues with PHP integration with HTML, JavaScript/jQuery, and AJAX functionalities

My HTML registration form is supposed to be a "step by step" form, using JavaScript and Ajax to call PHP in order to send an email with the values entered into the inputs. However, yesterday it sent an email without those values and the directory update di ...

Angular animation causing unexpected behavior with CSS z-index

I am currently working on incorporating a drag and drop feature into my application. My goal is to designate the drop zones with text that will disappear once an item is added. In terms of design, I would like to utilize animate.css's bounce in animat ...

Utilizing a JavaScript script within an AngularJS directive

As a newcomer to Angular, I am in the process of transitioning an application to utilize Angular. Within this application, there are several custom JS scripts that need to be integrated. It has come to my attention that all DOM manipulations should ideally ...

Is it possible to change the background color of a MUI theme in ReactJS by using Css

Currently, I am utilizing Material UI to create a theme that is functioning correctly. However, upon adding <CssBaseline/> to the App.js file, it unexpectedly changes the background color to white instead of the intended #1f262a specified in the inde ...

Using arrays to update text in HTML5 Javascript

Excuse the mess in my code, I'm sure it's far from perfect in the eyes of coding professionals! But let me explain - I am currently working on a game where users have to answer questions with three options. The questions and answers are all store ...

Updating the Background Image Based on Text Input in JavaScript

Struggling to utilize the text entered into a text input field as a background image URL. Ensuring it is valid is key. This snippet displays what has been attempted so far... CSS: body { margin: 0px; padding: 0px; border: 0px; } .bgimg { backgr ...

I'm puzzled as to why my bootstrap dropdown menu is expanding to fill the entire width of the webpage despite its supposed small size

I recently created a drop-down menu and an input form using the code below: <div class="container-fluid"> <div class="dropdown"> <button class="btn btn-info dropdown-toggle" type="button&quo ...

Adding a border to the input field in Bootstrap for enhanced styling and visibility

Looking to replicate the border style on an input element as shown in this image: https://i.sstatic.net/a2iwZ.png The current code I have is producing a different result. Can anyone assist me in achieving the desired border style? <!DOCTYPE html> ...

Owl carousel issue: Fixed position not functioning properly

To view the page with the issue, click here I am attempting to make the column (div) day/date headers sticky when they scroll out of view so that users can always see what day they are looking at. Instead of directly manipulating the header itself, I have ...

Function for triggering character or camera movement upon the pressing of a button

Just starting out here with web coding and I'm trying to create a function that moves my game character when a button is pressed. The idea is to change a boolean value to "true" when the button is pressed down so that the character moves. I've at ...

Is there a way to conceal a div class on the Payment page in Shopify?

I have encountered an issue with the code on the Shopify checkout (Payment) Page. Unfortunately, I am unable to directly edit this page within Shopify, but I have discovered that it is possible to add custom CSS or HTML code within the checkout settings of ...

Tips for implementing relative links in CodeIgniter

Below is the code snippet from my Controller: class MyHomeController extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->library(' ...

Bing Webmaster Tool identifies excessive HTML size on your website

After running a site scan using the Bing Webmaster Tool, I discovered that some of my pages contain the issue of "Html size is too long". One specific example is this page: I am unsure how to address this issue. According to Bing, it could be due to the w ...

Problem with CSS animations in IE10

I've encountered a problem with a specific section of a website I created. This section functions perfectly on all browsers and older versions of Internet Explorer, but not on the latest versions. It seems that IE no longer supports [IF] statements in ...

Performing real-time calculations for standard deviation

I am working with a set of HTML input fields labeled "textfield". I would like to calculate the standard deviation dynamically and display it in another HTML input field. Here is the JavaScript code I am using for the calculation: <script type=&quo ...

Leveraging external style sheets while a website is live on the internet

As I dive back into website development, one thing I've been exploring is the use of external style sheets. When working on a site locally, you would typically include the CSS file using: <link rel="stylesheet" type="text/css" href="main.css"> ...

I am encountering an issue where my Vue navbar is successfully changing the route but not updating the corresponding router-view

I have been working on a single-page application using Vue and I encountered an issue with the navbar when navigating through routes. The problem is that after the first click on a navbar item, the route changes successfully but the router-view does not up ...

What is the method to indicate the location for placing values in an HTML form for a GET request?

Scenario I am working on a scratch project where I have created a sign-in page using Google Sites. To manipulate the output of the username block, I am utilizing forkphorus. In my Scratch project, I have developed a script that extracts the username string ...