Creating a fixed layout of background images in a grid

Looking to design a CSS page background that mimics a grid made up of various cropped and resized images all with the same dimensions.

The goal is for this background to fetch random JPEGs from a designated folder I will create (assets/images/background_photos) and display them across the page in a predefined section.

We envision something similar to the image provided, but with multiple images instead of just repeating the Star Wars poster: https://i.sstatic.net/2bTQn.png

.movie_poster_background{
    background-image: url("background_photos/star_wars.jpg");
    background-size: 150px;
    width: 100%;
    height: 500px;
    position: absolute;
    z-index: -1;
    -webkit-filter: grayscale(1);
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    filter: gray;
    filter: grayscale(100%);
    opacity: 0.2;
}

Answer №1

If you're looking to create a dynamic background, try incorporating multiple images and adjusting their positions accordingly:

.box{
    background-image: 
      url("https://picsum.photos/200/200?image=1069"),
      url("https://picsum.photos/200/200?image=1065"),
      url("https://picsum.photos/200/200?image=1066"),
      url("https://picsum.photos/200/200?image=1067"),
      url("https://picsum.photos/200/200?image=1068"),
      url("https://picsum.photos/200/200?image=1062");
    background-size: 200px 200px;
    background-position:0 0,200px 0,400px 0,
                        0 200px,200px 200px,400px 200px;
    background-repeat:no-repeat;
    width: 100%;
    height: 400px;
}
<div class="box"></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

What is the best way to organize table rows into a single column when the window is resized?

I am working on a table that has three pictures in a row, with 100% width. I want the table to be responsive and stack the pictures into one column when the space is limited. The issue I am currently facing is that the elements of the table do not stack i ...

Expanding section beneath a Row in a Table (Semantic UI React)

I'm attempting to implement expandable Table Rows in a Table that can be activated by clicking on them individually. For instance, upon clicking on the designated area in the provided image below, a Segment or Container will reveal itself with embedd ...

Having trouble with the JQuery click function not responding as expected

I want to create a button that, once clicked in the center, will cause all elements within a div to slide upwards. $(document).ready(function() { $("#imgs").click(function() { $("#start").animate({ bottom: "+=250px" }, "slow"); }); }); ...

Can anyone provide a method for identifying the location of the page fold on a specific viewport?

Many innovative designs have successfully managed to position their content above the page fold in a way that it always remains visible within the viewport. Currently, I am using JavaScript to calculate the height, but this approach has its drawbacks. Her ...

Troubleshooting alignment problems with a responsive gallery (Bootstrap-gallery & justifyGallery)

Looking to showcase a gallery of images using jquery-justifyGallery and bootstrap-gallery. Want to display 4 images in a row, but running into issues when trying to display 5 images where the last image in the row ends up with a larger width. Bootstrap has ...

What is the best way to divide an HTML table into two sections?

I'm looking to organize my data into a table with two separate sections, one on the left and one on the right. For example, if I have 20 rows of data, I want to display the first 10 rows on the left side with headers and the remaining 10 rows on the r ...

Unable to apply text decoration to a floating element

Why is text-decoration not applying to a span inside a div after floating the span, and how can this be fixed? To see the issue in action, visit: http://jsfiddle.net/wtBDX/2/ div { color: red; text-decoration: line-through; } div span { float: rig ...

Steps for creating a div that appears on top of all other elements on a webpage

I have created a custom dropdown list with checkboxes from scratch because the project I am working on needs to be compatible with older versions of IE. Overall, the result is good but there is one issue - when I click on the drop down list, every other el ...

Interactive Map Using HTML5, CSS, and JQuery

As someone venturing into the world of web front end development, I am curious about the process of mapping an image so that specific functions can be triggered by pressing different parts. In this case, the shapes will be irregular (such as a map of Europ ...

Hover over a picture to reveal hidden text

Is there a way to create a text overlay on an image with the text box appearing directly over where the image is positioned, causing the image to disappear completely? When the mouse moves away, the image should reappear. I have looked everywhere for a s ...

Unable to implement styles or classes in Vue.js when utilizing it in a loop

My code has a feature where item.fav starts as false, but changes to true when a button is clicked. I want the color of the icon to turn purple when item.fav is true, but it's not working as expected. <template> <v-container fluid> ...

Positioning Input and Dropdown Elements within a Data Table Using CSS

I am currently working on setting up a data table for an application using Vue.js, and I am facing a challenge in relation to the arrangement of input elements. The specific requirement is that certain columns within the table should contain values that ar ...

CSS does not seem to support nesting list elements within other list elements

<ul> <li>One <li>two</li> </li> </ul> Attempted to target the second <li> with: li li { background: "red"; } Questioning the reason for it not functioning as expected. ...

Using HTML or JavaScript to generate a multitude of identical HTML elements on a webpage

I am currently designing a page that requires the presence of numerous tree illustrations with leaves, spanning across the width at the bottom of the page. I have considered two methods to achieve this. One option is to create a single set of trees and lea ...

Troubleshooting FireFox with TinySlideShow

I'm encountering an issue with my TinySlider on FireFox. The image is appearing partially inside the slider area and partially outside to the left, which is quite bothersome. When I tried to fix it for FireFox, it ended up breaking in other browsers. ...

Tips for showing form data upon click without refreshing the webpage

Whenever I input data into the form and click on the calculate button, the result does not appear in the salary slip box at the bottom of the form. However, if I refresh the page and then click on the calculate button, the results are displayed correctly ...

`Place text to the right side of the image`

Is there a way to align all three lines of text to the right of an image without wrapping on the second line? If you have any suggestions, please let me know! Check out this JSFiddle for reference. CSS: img { min-width:75px; height:90px; ve ...

Using different browsers can cause web fonts to appear rough and pixelated

While exploring the issue of "jagged" or "pixelated" fonts, I made an interesting discovery. After creating a website locally and viewing it in Firefox, the font from Google Webfonts appeared flawless - almost like it was straight out of Photoshop. It wasn ...

Toggle the visibility of div elements by clicking on another div

Hey everyone, I have this cool concept where clicking on different flags will reveal a corresponding list. However, my jQuery code doesn't seem to be functioning properly. $('.canadaflag').click( function() { $(".canadalocations").toggl ...

The setInterval function for the automated image slider is experiencing issues and is not functioning properly

I am facing an issue where the third photo in the slider does not appear initially. Eventually, the slide fails completely, causing the photos to change rapidly. Strangely, after the slide fails, the third photo sometimes appears sporadically. I am puzzl ...