Mosaic Magic with Bootstrap 4

Struggling with creating a mosaic-style layout here. I've tried using Bootstrap 4's grid system, flex, and other methods, but no luck getting it to work seamlessly across all devices.

Attached an image of the layout - the middle two boxes are for text content and the rest are images that need to display well on different devices.

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

Would greatly appreciate any assistance!

Answer №1

Feel free to test out this code snippet

.item1 {
  grid-area: area1;
}

.item4 {
  height: 100px;
}


.item5 {
  grid-area: area5;
}


.grid-container {
  display: grid;
  grid-template-areas:
    'area1 . .'
    'area1 area4 area5'
    'area1 . area5'
    '. . area5';
  grid-gap: 2px;
}

.grid-container > div {
  background-color: #323232;
  text-align: center;
  padding: 40px;
}
<div class="grid-container">
  <div class="item1"></div>
  <div class="item2"></div>
  <div class="item3"></div>  
  <div class="item4"></div>
  <div class="item5"></div>
  <div class="item6"></div>
  <div class="item7"></div>
  <div class="item8"></div>
</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

Delay the occurrence of a hover effect until the previous effect has finished executing

As I hover over an element, the desired animation is displayed while hiding other elements on the page. The challenge I'm encountering is that if I quickly hover over many divs, the animations queue up and hide the divs sequentially. I want only one ...

Having trouble accessing the link from the dropdown list in Selenium

While trying to select a link from a dropdown menu, I am facing an issue with Selenium. The element is being located successfully, but it cannot be interacted with and the following exception is thrown: Error in thread "main" org.openqa.selenium.ElementNo ...

Adjust text size within a div when hovering over it

I have a div with many elements inside. When the user hovers over the div, I want to increase the font size within that specific div. Here is the HTML code structure: <div class="col-sm-5 home-grid-2x"> <div class="home-grid-2 ...

The button is obscured by the dropdown menu

Here is the code snippet I am working with: HTML <nav class="navbar bg-dark navbar-dark"> <div class="container-fluid"> <div class="navbar-header"> <a href="#" class=&quo ...

Utilizing Django to recycle an HTML block for multiple for loops within the same template

I have three specific states for an object - 1. to start, 2. started, and 3. finished. Upon filtering the objects in view, I pass three variables to the template - tostart_objects, started_objects, and finished_objects. My current approach involves loop ...

Tips on deactivating or disregarding a click() event

I have created a card with an anchor tag and added an onclick() event to the card using its id. The click is working fine, but the issue is that even if the checkbox, image, or button inside the card is clicked, the click event of the card is triggered. Ho ...

What is the best way to conceal a specific class of DIV within a container, and how can I also hide another DIV within the same container by

I have a DIV class containing around 10 elements within a container. I am looking to implement a feature where these elements are hidden and shown one by one every 15 seconds using jQuery with a smooth fadeOut() effect. Your assistance in achieving this wo ...

Using PHP to extract data from multiple HTML arrays

I am facing a challenge with using jQuery to dynamically add more input tags in order to collect multiple data and treat them as an array. However, when I process this with PHP, only one data is being sent. Can someone please assist me with this issue? &l ...

Display a <button> element as a text hyperlink within a paragraph, ensuring proper wrapping and flow

I want to incorporate a link-styled <button> within a block of text while ensuring that it flows smoothly with the surrounding content. Although styling the button is straightforward and setting display: inline allows it to blend into the text flow, ...

The vertical scrolling issue arises when the content exceeds the height of the screen

Seeking a solution to enable scrolling of users within a flexbox menu, I've come across an interesting discovery. When setting a specific height in pixels for my nav element (like 100px), everything works perfectly. However, when I set the height to 1 ...

Stop flash notifications from sliding below the container

Creating a web application using Bootstrap 4, I implemented user notifications with alerts according to the documentation found here. However, I encountered an issue where the content below the alert shifts when the alert is displayed and then shifts back ...

Is there a way to continuously cycle through multiple images fading in and out at various locations on a webpage using absolute positioning?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <title>Harley's Art Gallery</title> <script t ...

A guide to dynamically adjusting the overflow property for the body element within an AngularJS application

I am facing a challenge in my AngularJS application where I need to dynamically control the overflow on the body element. Specifically, when a side nav is opened, I want to disable scrolling on the body. Below is a snippet of my code and I would appreciate ...

Bootstrap grid button with maximum flexibility

I am currently exploring the intricacies of the bootstrap grid system. My goal is to create a set of buttons that look like this: https://i.sstatic.net/V5meG.png Each button should expand to fill the width and height of its container. However, when a b ...

Using jQuery to create a script that will transition random images simultaneously within a div

I am currently working on a JavaScript script that will animate 10 images flying into a div, appearing side by side. The goal is to have each image fly in randomly with a unique transition. At the moment, my script is almost complete as I've successf ...

Utilizing Node.js and Express.js to Parse HTML Form Inputs

Having trouble extracting input from an HTML form and utilizing it in Node.js. Here is the HTML form being used: <form action="/myform" method="POST"> <input type="text" name="mytext" required / ...

spontaneous generation of web page elements

I want to implement a coverflow using the plugin found at this link: Here is an example of how it can be done: <div class="coverflow"> <div class="cover">A</div> <div class="cover">B</div> ... <div class=" ...

Getting form field values with JQuery

I am currently facing an issue with a form field in HTML. Here is the code snippet: <form id="tasklist"> <input type="text" id="name" ...></input> ... additional form elements go here ... </form> Although I am trying to retrie ...

Child Component featuring an Accordion group implemented with ngx-bootstrap

Primary Component <input type="button" class="btn btn-primary" (click)="allExpanded = !allExpanded" [attr.value]="allExpanded ? 'Collapse All': 'Expand All'" > <div class=& ...

Avoid auto-scaling of div content

I need the .content within the main container .box to resize proportionally to match the width of the .box exactly, without being smaller. .box { width: 95%; background-color: red; padding: 20px; text-align: center; margin: 55px auto 40px; } . ...