Troubleshooting Firefox problem with CSS horizontal inline display of multiple photos in a single row

After researching various solutions for this issue, I have experimented with multiple methods but have been unsuccessful in resolving the problem at hand.

I have successfully created a photo gallery that is arranged in a single horizontal row. The parent DIV container stretches across 100% of the browser width and contains a child DIV with a substantial width (4000px+) to house the images in a row. Through PHP scripting, photos are automatically inserted into the folder.

Everything runs smoothly in Chrome, Safari, and Opera. Despite having four photos and a wide child DIV, the horizontal scrolling stops after the fourth image has been displayed.

In Firefox, however, the browser shows empty space beyond the last photo, allowing users to scroll endlessly even after reaching the end of the gallery. I have attempted various approaches to rectify this issue without success.

The CSS styling:

#photoparent {
border-top: 1px solid white;
clear: both;
height: 600px;
overflow-y: hidden;
}

#photochild {
background-color: #000000;
margin-right: -5800px; 
}


#photochild img {
float: left;
padding-right: 3px;
}

Answer №1

There is a simpler way to achieve the desired outcome. Images are inline elements, so by organizing your code as shown below, you can create a horizontal scrolling effect that will adjust perfectly based on the number of images.

CSS

.gallery {
  overflow-x: scroll;
  white-space: nowrap;
}

HTML

<div class="gallery">
  <img src="">
  <img src="">
  <img src="">
   ....
</div>

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 table on the page shifts position when viewed on different devices, sometimes not remaining between the header and footer

Here is a link to see how my page looks with the header, table, and footer: https://i.sstatic.net/U6tdO.png If you want to see how it looks when responsive (with smaller width), check out this link: https://i.sstatic.net/zsGkc.png I have encountered 2 ma ...

Using an Icon Button within a Material Card in React

I am attempting to place the edit icon button on the right side of my card, similar to the image shown below. Please refer to this sandbox link for the current output: VIEW IMAGE HERE SEE SANDBOX LINK HERE <CardHeader classes={{ ...

Start flicker issue in Vue 3 transition

I have created a carousel of divs that slide in and out of view on the screen. However, I am facing an issue where during the start of each transition, when a new div is rendered (i.e., the value of carousel_2 changes), it appears without the transition-en ...

Error: jQuery is unable to access the property 'xxx' because it is undefined

While attempting to make a post request from the site to the server with user input data, I encountered an error message saying TypeError: Cannot read property 'vehicle' of undefined as the response. Here is the HTML and script data: <!DOCTY ...

Tips for updating the color of the first td element in a table using a specific class

Below is the CSS code for my table: table.show-my-request-table { border: 1px solid black; margin-left:auto; margin-right:auto; border-collapse: collapse; } tr.show-my-request-table-header{ border: 1px solid black; } tr.show-my-requ ...

Restore checkbox to default setting

Is it possible to reset checkboxes in a form back to their initial status using javascript, PHP, jQuery, or any other method? Here is the code I am currently using: <form method="POST> <input type="text" name="name" id="name" value="default val ...

Tips for effectively locating code within a web browser's code base

Struggling as a new programmer in a new job with a fresh codebase, I am finding it difficult to connect the code to the webpage I am currently on. What methods can I use to locate the relevant HTML in the codebase that is being rendered in the web browser? ...

Adjust the Bootstrap Navbar by positioning one navigation item to the right side

I want to align the logout button to the right within my bootstrap navbar. https://i.stack.imgur.com/PDvSv.png Here is a demonstration of the current behavior: https://codepen.io/agrawalo/pen/mdbKYLX Code: <nav class="mb-1 navbar navbar-expand-sm na ...

Divide the bootstrap form from the outcome

I am in the process of developing a basic web application using Bootstrap that involves taking user input on a form, sending it to a database, and then displaying the data in a table below the form. The main challenge I am facing relates to the styling asp ...

Receiving an undefined value when trying to access the index of a data list array

I'm currently working on implementing a datalist that gets populated from a JavaScript array and want to identify which part of the array was clicked on. After some debugging, I discovered that my arrays are returning undefined or 0. I've trans ...

Preventing child elements from inheriting properties in a sequential order

Taking a look at this particular demo: http://jsbin.com/teqifogime/edit?html,css,output In the initial section, we observe that the text color changes simultaneously as the background color transitions, owing to inheriting properties from its parent cont ...

Switch from monochrome to color when hovering inside a clipping mask

I have successfully mastered the technique of changing an image from grey to color on hover using CSS and JavaScript. However, I am curious about whether it is possible to achieve the same effect using a clipping mask. Attached is an image that illustrate ...

Different from Local system, the code refuses to work when deployed on the server

I have implemented a basic form where onSubmit it collects the values and passes them to a JavaScript page (via an AJAX call), then sends the data to add.php and returns the result back to the HTML page. The code functions correctly on my local system, but ...

What causes my image to overlap my navigation bar when I rotate it?

Is there a way to rotate images in CSS without causing them to overlap with other elements on the page? When I try to adjust the rotation property, the image sticks to the top of the page and overlaps the navigation bar. Below is the code snippet: HTML C ...

Paper.js: Is there a way to prevent canvas height and width from changing when the window is resized?

My canvas with paperjs is set up to resize dynamically when the window is resized. I appreciate any help in advance. HTML <canvas id="myCanvas" height="800" width="1000"></canvas> JS var Initialize = function () { var canvas = document ...

The tooltip malfunctions when I incorporate the PHP variable

When I use PHP variables to return an HTML span tag, I am encountering an issue. The span tag contains a title field where I bind my PHP data. However, it seems to only accept the first sentence of my PHP value, causing it to not work properly. Below is th ...

Using CSS to create a series of spans separated by commas

Imagine having 4 spans arranged in a block on your webpage. These spans are filled with content from a knockout viewmodel, but sometimes they may be empty. How can we display them in a visually appealing, comma-separated format while considering their poss ...

the ajax success function is malfunctioning

I'm encountering an issue with my ajax function. I am trying to change the CSS for certain HTML elements on 'success', using the following code: success:function(d){ $('#name').css('weight','normal'); ...

Can a screenshot of a YouTube video be printed exactly as it appears on a website?

Is there a way to print a page with an embedded YouTube video without it showing up as a blank area? I want the printed version to display the same still shot that appears on the web. If this isn't possible, I will use a noprint stylesheet. Here is ho ...

Discover the closest location using geolocation technology

My collection includes various national parks like Alcatraz Island, Death Valley, and Biscayne, each with their respective coordinates. Is there an efficient method to determine the closest park from my database based on the user's current location, ...