Image Width in Firefox Parent Element Exceeds Limits

When using a responsive picture element, the parent element does not receive the correct width in Firefox on OS-X.

Are there any solutions or workarounds for this issue?

.picture-wrapper {
  float: left;
}

.next-element {
  float: left;
}
<div class="picture-wrapper">
<picture>
   <source media="(min-width: 1000px)"
      srcset="
        //placehold.it/1200x600 1200w"
      sizes="800px" />
   <img class="image mix-image_buffer"   
      sizes="
        (min-width: 400px) 100vw,
        calc(100vw - 50px)"
      srcset="
        //placehold.it/200x200 200w,
        //placehold.it/250x250 250w,
        //placehold.it/300x300 300w,
        //placehold.it/480x480 480w,
        //placehold.it/600x600 600w,
        //placehold.it/960x960 960w"
     src="//placehold.it/200x200" />
</picture>
</div>
<div class="next-element">Caption</div>

Codepen link: http://codepen.io/anon/pen/GZVeYw

Result:

Firefox

There is white space between the picture element and the next element

https://i.sstatic.net/eUBKt.png

Chrome / IE

In Chrome and IE, it works as expected without any whitespace present

https://i.sstatic.net/Nx4dW.png

Answer №1

This issue is not limited to just the bug within the <picture> tag, but affects any ancestor element.

To temporarily resolve this bug, you can set the width using CSS if the width is known.

<img class="image mix-image_buffer"
  sizes="
    (min-width: 400px) 100vw,
    calc(100vw - 50px)"
  srcset="
    //placehold.it/200x200 200w,
    //placehold.it/250x250 250w,
    //placehold.it/300x300 300w,
    //placehold.it/480x480 480w,
    //placehold.it/600x600 600w,
    //placehold.it/960x960 960w"
  src="//placehold.it/200x200"
  style="width: 600px" />

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

Insert details into Mysql database

This indicates an issue with Line 15 of my code. I would like to include additional details and have them displayed in a table. see image here Error alert: syntax error, unexpected ';' in N:\ftp\compc\ac12mm\untitled folder& ...

Using Vuetify: adding an asterisk to indicate required fields

The most recent update of Vuetify (v1.3 - ) has brought a significant change. Now, the asterisk is no longer automatically added to the label when using v-textarea/v-text-field with the required prop.. You will need to include it manually in the label pro ...

Steps to showcase an image from MongoDB in HTML using Java with Spring Boot

My current task involves displaying an image based on the unique identifier obtained from the FindById() method. I have successfully retrieved the image data from MongoDB through a Rest Call, but now I need to show this image to the user in a web browser u ...

Move your cursor over a specific element to trigger an effect on another element that is not directly next to or related to it

In my current project, which is built with Angular, I am looking for a way to achieve a specific effect without using jQuery. Specifically, I would like the text inside a div element with the class title to have underline styling when hovering over an im ...

Tips for keeping certain webpages from showing up in Google search results

I recently launched a website that allows users to create their own profiles. The problem is, when someone links to their profile from their website or blog, it ends up showing in Google searches for my site. Unfortunately, the only person who has done thi ...

Incorporating Layouts and Partials in Handlebars Template

Can you provide guidance on incorporating layouts and partials with handlebars templates like the example below? I have reviewed the documentation on partials but am still struggling to achieve my desired outcome. default.html The default layout is util ...

What is the best way to ensure the button remains centered when the screen is resized?

.codrops-top { line-height: 30px; font-size: 13px; background: #fff; background: rgba(255, 255, 255, 0.8); text-transform: uppercase; z-index: 9999; position: absolute; width: 100%; to ...

Unable to render Material Icons on Vue/Quasar web app hosted on Azure

I am facing an issue with my webapp built using Vue and Quasar. I added the necessary icon imports to my quasar-user-options.js file. import '@quasar/extras/material-icons/material-icons.css' import "@quasar/extras/material-icons-outlined/ma ...

Closing the space between navigation bar choices

I'm currently working on my website's navbar menu and struggling to eliminate the gap between each of the navbar links. It seems that the li attributes with the class dropdown are slightly wider than the rest of the links, causing this issue. I&a ...

Link HTMLMediaElement with Android's playback controls

For my HTML/Javascript audio player that supports playlists, I have implemented a feature where the ended event automatically plays the next media in line. Everything works smoothly when using the player on Android Bromite browser, including the playback c ...

Paper.js - Applying transparency to shapes that extend beyond set boundaries

I am currently using a simple rectangle as the clipping area for all shapes added to the canvas, and it's working perfectly: var area = new paper.Rectangle( 100, 100, 300, 120 ); var path = new paper.Path.Rectangle(area); group.addChild(path); ...

What is causing my css elements to appear larger compared to other instances?

As someone who is not a designer, I find myself doing a lot of cutting and pasting for my side hustles. I believe many others can relate to this experience. Currently, I am working on a personal project that involves using tailwindcss, appwrite, and svelte ...

Has anyone experienced challenges with _POST data getting blocked on a hosting server provided by Godaddy?

Utilizing a form processor known as JotForm, I have encountered an unusual issue. When attempting to print all POST data, I am faced with an empty array, specifically when the page is hosted on GoDaddy. Strangely, while hosting it locally on localhost, no ...

Using the ng-app directive value with HTML and CSS can sometimes cause issues and the styles may not apply

angular.js:38 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=mainapp&p1=Error%3A…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A19%3A463) <body ng-app=""> It was working fine unt ...

Prevent time slots from being selected based on the current hour using JavaScript

I need to create a function that will disable previous timeslots based on the current hour. For example, if it is 1PM, I want all timeslots before 1PM to be disabled. Here is the HTML code: <div class=" col-sm-4 col-md-4 col-lg-4"> <md ...

Show each item in the list vertically, using a single unordered list but displaying them in

Is there a way to display list items vertically in multiple columns using only a single ul? I need the output to look like: a e i b f j c g d h Any suggestions on how to achieve this would be greatly appreciated. Thank you! ...

Using JavaScript to display content on the page after handling a form

Hey there! I'm currently working on a website project where users can input their name and have it displayed on the page. My plan is to achieve this using JavaScript. HTML: <div id='errormsg'></div> <form action='' ...

Adjust the size of my navigation bar to match the dimensions of the browser

I'm currently facing an issue with my website's navigation menu on mobile devices. I've been attempting various solutions to make the navigator scale up appropriately with the browser, but so far nothing seems to be working. Below is the HT ...

Using JQuery to dynamically set dropdown option values from a JSON object

I have an HTML code snippet: $.ajax({ type: "POST", url: "hanca/hanca_crud.php", dataType: 'json', data: { id_hanca: id_hanca, type: "detail_hanca" }, //detail_hanca success: function(data) { var teks = ""; $.each( ...

Employing ng-style for establishing background when the value does not align

Greetings all! I am using ng-repeat to create a list of items within a ul element. Within the json data, there is a specific value that I want to highlight if it does not match a predefined string. Here's what I have so far: ng-style="{'backgro ...