Responsive HTML5 audio player adjusts size when viewed on mobile devices

I am facing a challenge with an HTML5 Audio player. It looks fine on desktop but behaves strangely on mobile devices. While the width remains intact, it repositions itself and floats over the element it is contained within. How can I prevent this repositioning on mobile devices?

Hopefully, you can see the yellow border for reference.

Desktop screenshot:

Mobile screenshot:

Upon zooming in on a mobile device, the player gradually moves towards its intended position (and the controls become visible) - as you continue to zoom, it keeps moving upwards until reaching the middle of the element:

Zoomed-in mobile screenshot:

I have experimented with various position values and conducted thorough research online. However, I am unable to comprehend the root cause of this issue, making it challenging to identify where to begin troubleshooting. I hope someone could provide assistance.

HTML:

<div id="audiowrap">
  <audio controls controlsList="nodownload">
    Your browser does not support HTML5 Audio
  </audio>
</div>

CSS:

audio { margin:0 0 0 5px; width:540px; }
#audiowrap {
  margin:0 auto; border: 1px solid yellow;
}

Answer №1

Upon checking on an iPhone X, it appears that the content is overflowing the container and creating space at the top.

If the width is removed, the overlap at the bottom will no longer be an issue.

Take a look at the code here

audio {
  margin: 0 0 0 5px;
   background: red;
}

Debugging this issue on a physical device can be challenging, but connecting your device to a computer with cables can make testing easier. It seems like the player has a specific height (with a red background) and some default styles that might need to be overridden - best done by inspecting on a computer for a clearer understanding

Answer №2

Encountering a similar problem, I found that the HTML5 audio player appeared oversized on mobile and tablet devices. To resolve this issue, I applied the solution of adjusting the height with .player{height=40px;}.

By implementing this change, I successfully resolved the issue of excessively large audio players on mobile platforms.

Answer №3

<div id="soundcontainer">
  <audio controls controlsList="nodownload">
    Your current browser does not have the capability for HTML5 Audio
  </audio>http://162.210.197.146:9423/
</div>`additional code here`

Quoted Text

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

jQuery fails to apply a class if the input fields are not empty

I am currently working on a function that displays a login button only when both input fields are not empty. However, for some reason, jQuery seems to be giving me trouble with this task. Despite checking and ensuring that I am using the correct and updat ...

In CodeIgniter, the $this->input->post() function consistently returns an empty value

I'm encountering an issue where the value from an AJAX post always turns out empty. Even after confirming that the value is correct before the post, I'm unable to retrieve it using $this->input->post() HTML <?php if ($product_info-> ...

Tips for properly sizing 13 images in Next.js

I've been facing some challenges while working on a responsive website, particularly with getting the sizing right. When viewing my image on mobile, everything looks good: https://i.sstatic.net/gNm14.png However, when I switch over to desktop view, ...

"Styling a play button on top of an image using CSS

Can someone please assist me in properly displaying a play button over a thumbnail using CSS in my WordPress site? I have tried various methods without success. Any guidance on where I may be going wrong would be greatly appreciated. .post-thumbnail-sid ...

How can the presence of a CSS rule prevent another from being applied?

My attempt to create this HTML file in Chrome posed some challenges: <style> br { }​ [required] { border-width: 3px; border-color: red; } </style> <input required /> The entire content of the file is shown above. However, I noti ...

Implementing a backdrop while content is floating

I am facing an issue with a div that has 2 columns. The height of the left column is dynamically changing, whereas the right column always remains fixed in height. To achieve this, I have used the float property for both column divs within the container di ...

Embedding complex JSON information into an HTML dropdown menu

Here is a JSON string that I am working with: { "electronics": { "cameras": [ "sony", "nikon", "canon" ], "TV": "none", "laptop": [ "hp", "apple", "sony" ] }, "home": { "furniture": [ ...

What is the best way to retrieve the object of the selected option from a single select input in Angular

I'm currently working with an array of objects that looks like this: let myArray = [{'id':1,'Name':"ABC"},{'id':2,'Name':"XYZ"}] I'm trying to retrieve object values based on a dropdown selection, but so ...

Modify the width of the progress bar in Bootstrap using AngularJS

I'm new to AngularJS and I'm attempting to dynamically update the width of a progress bar based on changes in my controller. Here is what I currently have: <span id="percentage">$ {{getTotal()}} ({{getPercentage()}}%)</span> <div ...

Improving JavaScript event management efficiency through handling numerous asynchronous HTTP requests

Summary: In a SPA CMS project, multiple dynamic data sources are causing performance issues due to a large number of asynchronous HTTP calls required to display a table with extensive data. The challenge is to maintain good performance while handling the ...

Navigate through the parent elements and show the text if the child element is not present

I'm currently exploring how to iterate through all parent classes (.grid) and if there is no child div with the class (.image-container), then to display the (.content-container) within the same (.grid) section. HTML: <style> .grid .content-co ...

What is causing all webkit browsers to overlook the z-index in my code?

I have removed all unnecessary elements from my webpage to focus on reproducing a specific issue. HTML: <html lang="en-us"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initi ...

What steps should I take to ensure that this 3D transformation functions properly in Internet Explorer 10?

I'm struggling to get a CSS 3D transform to function properly in IE10. The issue arises because IE10 lacks support for the preserve-3d property. According to Microsoft, there is a workaround available. They suggest applying the transform(s) of the pa ...

Conceal any child elements that are cut off as a result of the overflow hidden property

Despite the numerous questions on this topic, none provide a suitable answer. In this scenario, the overflow hidden property is applied to the parent div. The goal is to display only the child elements that are fully visible within this container. In the ...

A step-by-step guide on toggling between light mode and dark mode using water.css

Implementing the water.css on my website, I have this JavaScript code: function setTheme(themeName) { localStorage.setItem('theme', themeName); document.documentElement.className = themeName; } // function to toggle between light and dark ...

Determine the total character count in every paragraph

Looking for a way to tally up the number of characters in each paragraph on a webpage. Came across this handy snippet that counts words in paragraphs and it works like a charm. Wondering if it can be tweaked to also calculate the character count. There are ...

AngularJS: Creating a dual-column layout with alternating styles

Struggling to create a two-column layout that repeats in AngularJS using a JSON object of image data. I'm aiming for a display of images in a side-by-side format, but my odd/even logic seems to be off no matter what adjustments I make. Can anyone poin ...

What is the best way to retrieve an element made in a different function within JavaScript?

I have a main button on the screen and when I click that button, it generates two more buttons. These additional buttons should each have their own functionality and click events, but since they are created within a function without global variables or ids ...

Hover over a child DIV element to dynamically alter the style of its parent DIV element

Attempting to create a simple CSS hover effect. <div class="menu"> <div class="child"></div> </div> <div class="nav"> <div class="item1"></div> </div> The desired outcome is for the style of < ...

Unable to retrieve file path from image selection in JavaScript by clicking on a button

I am trying to create a simple browsing feature that only accepts images. However, after clicking the button, I am unable to retrieve the full path in JavaScript. All I can get is the filename. JavaScript <script type="text/javascript"> functio ...