creating a non-standard pattern with CSS styling

My goal is to showcase images using a grid format that includes stacked smaller thumbnails on the left side of the row. However, I am encountering difficulty in stacking two smaller thumbnails on top of each other in this layout.

Answer №1

If you're looking to create a grid layout, here's one way to do it. (check out the code snippet here: http://jsfiddle.net/joplomacedo/ygtYx/ )

The structure in HTML...

<div class="row">
    <div class="col narrow stack">
        <div>insert image here...</div>
        <div>insert image here...</div>
    </div>
    <div class="col large">insert image here...</div>
    <div class="col narrow">insert image here...</div>
</div>

<div class="row">
    <div class="col narrow">insert image here...</div>
    <div class="col large">insert image here...</div>
    <div class="col narrow stack">
        <div>insert image here...</div>
        <div>insert image here...</div>
    </div>
</div>
​
​

The styling in CSS...

.row,
.col,
.stack > div {
    /* 
      Consider applying this style
      to all elements using the * selector.
      You may customize as needed.
     */
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.row:after {
    content:"";
    display: table;
    clear: both;
}

.col {
    float: left
}

.col.narrow {
    width: 25%;
}

.col.large {
    width: 50%;
}

.stack > div {
    height: 50%;
}

This setup should be easy to understand and modify for your specific needs.

Answer №2

I have found a solution for achieving that effect. The simplest method involves placing smaller thumbnails inside another div with equal height to the original div, and then inserting both images within it. It is important to carefully calculate the margin, padding, and border in order to maintain consistent height.

If you could provide your code, I would be happy to take a look and identify any potential issues.

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

Implementing Bootstrap in Wordpress using functions.php

The code snippet below is stored in my functions.php file within a Child theme directory. <?php function theme_styles() { wp_enqueue_style( 'bootstrap_css', get_template_directory_uri() . '/bootstrap.min.css' ); wp_enqueue_ ...

What is the option for receiving automatic suggestions while formatting components in a react.js file?

When styling elements in our app using app.css or styles.css, VS Code provides auto-suggestions. For example, if we type just "back" for background color, it will suggest completions. However, this feature does not work in react.js or index.js. Why is that ...

Issues with plugins in Rails 4 are causing functionality to not be operating

I recently installed a template and encountered an issue with some of the JavaScript functionality. However, upon checking the compiled list of JavaScript files, I can see that all the files have loaded successfully and the CSS includes all the necessary f ...

Design a dynamic rectangular division using CSS and Bootstrap 4 that adapts to different screen sizes

I am encountering difficulties attempting to replicate a full-width rectangle div on a website, particularly with issues related to responsiveness and mobility. Here is an example of the design I am trying to recreate. And here's what I've acco ...

Design a custom JavaScript component for seamless integration with CSS styling

Currently working on a JavaScript API using jQuery for my website. In one part of the code, I am attaching an object that contains CSS to an element like this: $(element).css(theVariable); The expected outcome should match this CSS code snippet: h3 { ba ...

Having trouble formatting the Modal form in Bootstrap when using AngularJS

The code runs successfully, but I am struggling to get the desired output. You can find the code here. <div class="modal fade" id="signup" tabindex="-1" role="dialog"> <div class="modal-dialog modal-sm"> <div class="modal-content"> ...

Tips on replacing a React component's styling with emotion CSS

Is there a way to incorporate the background-color:green style to the <Test/> component in the following example without directly modifying the <Test/> component? /** @jsx jsx */ import { css, jsx } from "@emotion/core"; import React from "r ...

Is there a method to pre-load a CSS background image so that it can still be displayed even without an internet connection?

Situation: Imagine having a web app that shows an error message when trying to perform an action but fails due to a connectivity problem. The error dialogue has a CSS class with a background image that can't load because of the connection issue, res ...

A minuscule variation in width percentage due to a single pixel

I am experiencing an issue with a one pixel margin between two green colors on my website. I have been unable to locate the source of this problem. I am currently using display:inline-block. Here is the link to my website: ...

Stop iPhone body scrolling when fullscreen overlay is opened

My goal is to prevent the body from scrolling when my fullscreen overlay navigation is open. I have added a class show-nav to the body with the CSS attribute overflow: hidden, which works perfectly on desktop but not on iPhones. After researching similar ...

Optimal selection of selectors for every type of button in an HTML document

In my current setup, I am utilizing the following selectors: input[type="button"], input[type="submit"], input[type="reset"], button Do you think this is a comprehensive selection of selectors to cover all potential buttons on a website? ...

Utilizing a variety of pseudo classes within a single div element

Looking to achieve an outward border effect on an unlimited number of Divs. Experimenting with Pseudo classes like :first-of-type and :nth-of-type(#) but facing issues as the :nth-of-type(#) is overriding the :first-of-type. .quarter > div:first-of-ty ...

Is it possible to adjust the JavaScript slider effect to transition to a fade effect when the window width drops below 800 pixels?

Is there a way to make my JavaScript slider change its effect from normal to fade when the browser window is less than 800px wide? Any assistance would be greatly appreciated. <ul class="slider"> <li><img src="images/1" alt=" ...

`Align nth-child elements in the center based on varying display sizes`

How do I center the nth-child elements here? Currently, it aligns my divs in a row, which is what I want, but how can I center the elements in the middle of my page based on browser width? Right now, if I center the elements by changing left: px; it only w ...

Footer not being pushed down by content in mobile view on page

Hello everyone, Can you assist me with a query, please? My form works perfectly fine in desktop view, but it gets cut off on mobile view and I'm unsure of the reason why. Here is my code: .upload-pic { position: absolute; max-width: au ...

Dynamic Div that Continuously Adapts to Accommodate PHP/MySQL Data

I have developed a blog main page using PHP, incorporating a sidebar and main area for the posts. However, I am facing an issue where if I add more content to either the sidebar or the main content/posts area, the content overflows the main div without exp ...

What could be causing my slider to malfunction?

No errors are being returned by the console. Currently utilizing Unslider. The setup includes: <div class="slider"> <ul> <li><img src="img/one.jpg" alt=""></li> <li><img src="img/one.jpg" ...

Enhance the worth of text box

Is there a way to adjust the value of a textbox by one on keyup, keydown, or tap events? Check out this example. Here is the HTML structure: <div class="right-content" id="rc-0" style="height: 250px;"> <div class="right-cont-main" id="rcm-0" s ...

Upon refreshing the page, the React application alters the font style

While working on my ReactJS application, I noticed that the font changes after the page loads and then reloads. Take a look at the examples below: Before reloading (press f5): https://i.sstatic.net/tJFjU.png After reloading (press f5): https://i.sstati ...

List items not appearing inline

I'm having an issue with displaying a list of movies from my database. Instead of showing inline as intended, they are appearing vertically. I've tried using both inline-block and inline for the li elements, but so far nothing has worked. Any ass ...