Pictures appear stretched on mobile browsers

The issue with picture display differences between my phone and computer

When viewing pictures on my mobile browser, the height of the images appears stretched compared to when viewed on a computer.

🡐 Computer view | Phone view (iPhone 6s, same issue in both Safari and Chrome) 🡒

HTML

<div class="pic-wrapper">
    <img src="img.png">
</div>

CSS

.pic-wrapper {
  margin-bottom: 30px;

  /* necessary for hover effect */
  position: relative; 
  overflow: hidden;
}

.pic-wrapper img {
  width: 100%;
  height: auto;
}

What could be causing this discrepancy?

Answer №1

It would be fantastic to see an example on the website http://codepen.io in the future.

I recommend removing: height: auto;

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

AngularJS throws an error of TypeError when attempting to assign a value to a property that is undefined

I am trying to combine data.id with company.action.actions but I keep getting an error: TypeError: Cannot set property '10' of undefined This is my current code: company.action={}; company.getOptions=function(){ // company.action={ ...

Fixed header scrolling allows users to navigate through a webpage without losing

I'm dealing with a fixed header setup that looks like this: <ul> <li> <li> <li> <ul style="width:932px;height:700px;margin-left:-430px;overflow-y:auto;overflow-x: hidden;"> My problem is that when I ...

Navigating to two separate webpages concurrently in separate frames

I am working on creating a website with frames, where I want to set up a link that opens different pages in two separate frames. Essentially, when you click the link, one page (such as the home page in a .html file) will open in frame 1 on the left side, ...

Issues with React's useState hook not updating properly

As a React beginner, I am facing an issue with my input field filtering functionality. The problem arises when the results are filtered and rendered, as it seems to be ignoring the last character of the input value. For instance: If I type in "s", nothing ...

Find the height of the viewport using jQuery, subtracting (n) pixels

Apologies if the topic seems puzzling, I couldn't find a better way to explain it. I utilized jQuery to adjust the height of a div to match the size of the viewport. var slidevh = function() { var bheight = $(window).height(); $(".container" ...

Utilizing Django to extract values and dynamically inserting them as placeholders on a separate page

On my initial webpage, there is a submit button that includes an array of necessary information in the value tag. <button type="submit" name="editEntry" value="[{{ entry.id }}, {{ entry.first_name }}, {{ entry.last_name }}, {{ entry.country }}, {{ entr ...

sending a selection of JSON string values to a jQuery function

I have a JSON string that contains different items, but I am only interested in the 'locked' array and would like to pass it to a jQuery function. The JSON string was generated using json_encode from PHP. {"ignored":[],"status":{"message":"succe ...

Connect to content on the current page

I am facing an issue where the linked heading of a section on the same page is getting lost under the fixed navigation bar when scrolling down. This problem seems to only occur on desktop view as it works fine on mobile preview. Here is the code I am curre ...

Retrieving an image from a JSON file based on its corresponding URL

I am trying to extract the URL and display it as an image: This is how it appears in JSON: https://i.sstatic.net/vpxPK.png This is my HTML code: <ul> <li *ngFor="let product of store.Products"> <p>Product Image: {{ product.Pr ...

Unable to Load CSS in New Magento Template

I have reached out to the template creator's website and Magento support for assistance, unfortunately, I have not received any response so far. Despite installing a custom theme that is said to be compatible with the latest version of Magento, the C ...

XPATH: Select the paragraph element that is directly followed by another paragraph element

Can anyone help me with selecting the first paragraph element that is directly preceded by another paragraph element? I have provided an example below to illustrate what I am looking for. <div class="vacancy-left"> <h2>Machine Operator / P ...

Difficulty encountered when attempting to implement custom filtering based on condition in HTML using Angular

I'm still new to angular, so please bear with me if this question seems trivial. I have a collection of integers in my controller and I need to filter it to only show items that meet a certain condition. Initially, I attempted the following: <div ...

Swapping out a style sheet within a intricate header

I'm in search of help with creating a stylesheet switcher for my website. My knowledge of html/css/js is self-taught, so I ask for forgiveness for any beginner mistakes. I have customized some code to fit my requirements, but I am unsure how to target ...

AngularJS selector, offering similar functionality to jQuery

There are 3 div elements with the same class in an HTML code snippet: <div class="hide"> </div> <div class="hide"> </div> <div class="hide"> </div> In jQuery, all the div elements can be hidden with a single code sta ...

Adjust css rotation to direct an element towards a specific point

Looking to rotate a div towards a point using the CSS 3 transform rotate function. Progress so far: View code on JSFiddle $(document).ready(function(){ var scw,sch,scx,scy; calcCenter(); $(window).resize(function() { calcCent ...

JavaScript Date Validation: Ensuring Proper Dates

I am working with a date string that is in the format of "DD-MM-YYYY" and have successfully validated it using this code: var dateFormat = /(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[012])-\d{4}/ ; if(!startDate.match(dateFormat)){ alert("'Start Dat ...

Tips for saving data obtained from an ajax call

My jquery ajax function has a callback that creates an array from retrieved json data. Here's an example: success: function (response) { callback(response); }, The callback function, in this case createQuestionsArray(), populates ...

Customize the theme of Ant Design for VueJS

I have successfully set up my Vue3 application with Tailwind and Ant Design. However, I am facing issues with customizing the Ant Design theme. I have been referring to this guide. When trying to customize the theme, I encountered the following error: Err ...

Is there a way to include two functions within a single ng-click event?

Is it possible to incorporate two functions in a single ng-click event? Below is the code snippet: <button class="cButtonSpeichern" ng-click="saveUser()">Speichern</button> In addition, I would like to include this function as well. alert ...

Discovering an item within a list by comparing it based on one of its properties

Is there a way to search through an array of objects and locate a specific object based on a property match? $scope.items = [ { id: 1, name: 'one' }, { id: 2, name: 'two' }, { id: 3, name: 'three' } ]; $scope.item = ...