The responsive website functions flawlessly in remote testing on Chrome, but encounters issues when live

My website gallery is responsive to all sizes when viewed on chrome at 127.0.0.1, but once I upload it to the live domain and host, the gallery appears oversized on all mobile phones. Below is the code snippet along with the CSS that I am currently using.

* {
    box-sizing: border-box;
  }
  
  img {
    max-width: 100%;
    vertical-align: top;
  }
  
  #gallery {
      display: flex;
      margin: 10px auto;
      max-width: 100%;
      position: relative;
      padding-top: $max-img-height/$max-img-width * 100%;
    }
<section class="gallery">
  <div class="gallery__item">
    <input type="radio" id="img-1" checked name="gallery" class="selector">
    <img class="gallery__img" src="images/p1.jpg" alt=""/>
  </div>
  <div class="gallery__item">
    <input type="radio" id="img-2" name="gallery" class="selector"/>
    <img class="gallery__img" src="images/p2.jpg" alt=""/>
  </div>
</section>

Answer №1

Have you included viewport meta tags in the head section?

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no" />

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

The fixed position setting does not anchor the elements to the bottom of a container

When applying the following styles: #fullpage-menu > .gradient { position: fixed; bottom: 0; left: 0; width: 100%; height: 0.3rem; } To the element with ID #fullpage-menu, which is styled as follows: #fullpage-menu { height: 100 ...

Varying heights based on the screen size

Currently, I am in the process of designing my website and incorporating some wave elements to enhance the background. However, I've encountered some issues when resizing the screen. Specifically, the waves seem to shift with a space between them as t ...

What strategies can I use to prevent any spaces between cards when I unfold them?

Hello, I am looking to create a basic webpage. In this link, there are 4 cards that can be opened. However, when I open card B, a gap appears between card A and card C - and I'm not sure why this is happening. Here is a link to the HTML code I have us ...

Dim the background for all elements except for one

Seeking a way to create a dimmed-background effect by adjusting the opacity of all elements on the page except for one specific element. I've experimented with using the :not() selector as well as jQuery selectors to exclude certain elements, but have ...

Make React background color span the full height

In my App.js file, I have a class that renders like this: const theme = createMuiTheme({ palette: { primary: lime, secondary: { ...grey, A400: '#00e677' }, error: red } }); class App extends Component { render ...

One-page website with a stationary navigation bar: How can the style of the "active link" be modified when on the relevant section?

Working on my single-page portfolio website and looking for a way to enhance the navigation bar. Currently, the nav bar is fixed in position and when a link is clicked, it smoothly scrolls up or down to the corresponding section of the page. Is there an ...

Numerals for Central Leaflet Marker

Is there a way to effectively center numbers inside markers? Here is the current situation: View Marker with Number How to Create a Marker return L.divIcon({ className: "green-icon", iconSize: [25, 41], iconAnchor: [10, 44], popupAn ...

Ensuring uniform height for video embeds and images within a single row

I have two divs with a 50% width each. One contains a simple image and the other includes a YouTube video embed. My goal is to ensure that both elements (image and video) have the same height, while maintaining responsiveness. I attempted to use the css ...

flex child moves outside parent when available space shifts

My dilemma involves a flex container (A) containing two or more flex items stacked in a column. The top flex item (B) is a Bootstrap Collapse panel, while the bottom item (C) consists of two horizontal divs (D and E). The problem arises when the collapse p ...

Tips for filling the offset space with a column

Having a bit of trouble phrasing my question, but here's the issue I'm facing: Currently, I need to develop two different views, the first being the mobile view However, I'm experiencing some difficulties with the second view, which can be ...

Fixed-top navbar in Bootstrap obscuring webpage contents

I have tried various solutions to the issue at hand, but nothing seems to be working. I applied padding-top to the container of my main content, but when I add the following CSS: @media (max-width: 768px) { body{ padding: 0; } } it overrides the padd ...

What is the best way to center a slick slider both vertically and horizontally on a

I'm struggling to get my slick slider carousel perfectly centered in any browser, whether it's on desktop Chrome or an iPhone X Max. The slider is currently stuck at the top of the page and I've tried multiple solutions without success. Thi ...

Is it possible to overlay two divs on top of a current website layout?

I am currently attempting to overlay two divs on top of an established website, similar to the layout shown in the image: While I am able to achieve this successfully in browsers like Firefox and Google Chrome, I am encountering difficulties when trying t ...

Struggling with the transition of a CSS navigation menu from hover to focus

I'm attempting to transition a "mega menu" from 'hover' to 'focus'. My goal is to have the dropdown menus appear "on click" and remain visible until another top-level selection is clicked. Ideally, I am looking for a CSS-only solut ...

Ensure the menu bar remains at the top of the page without using the position:

Check out this awesome fiddle here! My menu bar looks great at the top, but for some reason it won't stay in place when the user scrolls down. I've tried adding position:fixed to the CSS under the first #cssmenu, but it messes everything up. Her ...

Using display:inline-block will increase the vertical spacing

I am currently dealing with the following HTML and CSS setup: * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } body { margin: 0; } .row { background-color: red; /* display: inline-block; */ } ul { ...

The excessive width of the navigation bar resulted in additional blank space on the right side of

My navigation bar is causing me trouble as it appears to be too wide, creating extra space on the right side. I've tried adjusting the width with some code, but as I'm working on making the site responsive, shrinking the code down to around 320px ...

What is the best place in Rails to add @media CSS tags?

Currently, my layout.html.erb contains some CSS rules with @media queries. <style> @media (max-width: 900px) { .green-button{ display: none!important; } .chat_button{ margin-top: 20px!important; } #myCarousel{ ...

Choosing a dropdown option with a CSS Selector

Here is the code snippet I am currently working with: import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.o ...

How to position an image at the center in jQuery Mobile

I'm currently struggling to center an image in jQuery mobile using CSS. Despite trying various styles, the image refuses to budge from its original position. I even went to the extremes with my CSS to see if it would have any effect on the image, but ...