Arranging a collection of tiny divs or images side by side

Is there a way to stack multiple divs next to each other in a responsive manner, without causing any skew? I want them to line up neatly and adjust properly on different screen sizes. Should I consider using images for this or is there another method to achieve this layout?

Answer №1

Take a look at this example: Check out the responsive version here

And now, let's see the non-responsive version.

body{ /* or a DIV parent */
  perspective: 1000px;
}

div{
  padding: 60px;
  white-space: nowrap;
  transform: rotate3d(-20, -20, 15, -40deg);
}

div span{
  display: inline-block;
  width: 50px;
  height: 50px;
  color: #fff;
  font: bold 2em/1.5 sans-serif;
  text-align: center;
  margin:2px;
}
.W{background:#55CA55;}
.L{background:#D52A30;}
.D{background:#CCDC31;}
<div>
  <span class=W>W</span>
  <span class=W>W</span>
  <span class=L>L</span>
  <span class=W>W</span>
  <span class=L>L</span>
  <span class=W>W</span>
  <span class=D>D</span>
</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

Having trouble rendering a private route screen in React, while all the other screens work perfectly

I am encountering an issue with my Private Route in React where it fails to render, while every other screen renders successfully. I have set up the Private Route to render my PrivateScreen.js component, everything seems to be set up correctly but I cannot ...

Incorporate a PowerPoint presentation into an Iframe

Can you confirm if this code is correct? Is there another way to achieve the same result? Could you please provide some assistance with the code? I would like to show my PowerPoint file in an iframe when I click on a link. <html> <head> < ...

Having trouble with your jQuery/CSS background change not displaying correctly in Google Chrome?

When hovering over a link, I am using jQuery to change the background of the body. This functionality works flawlessly in Firefox and Internet Explorer, but unfortunately, Chrome (v37) does not reflect the background color change. I attempted to troublesh ...

Display additional fields based on a condition in ASP.NET Core 6.0 MVC for a Yes/No input

If a user enters either Yes or No in a specific field, I want to display additional fields that need to be filled based on their choice. <div class="col-6"> <label for="Renda Bruta">Demonstrativo do Ano</label> ...

Tips for truncating a long string on Firefox for a responsive design

Can someone help me figure out how to display a 2-line image text below? Sample Image This is what it looks like in Chrome, but unfortunately, it doesn't work in Firefox. I came across a website that has a tutorial for Chrome: https://css-tricks.com/ ...

Monitoring user logins based on user identification

How can I effectively monitor the activity of users who have logged into a web application that is managed by an external company? Despite my extensive research efforts, as a non-technical individual, I am struggling to understand how to utilize Google Ana ...

Trouble with triggering a jQuery event on a dynamically generated div

I have a snippet of code that generates dynamic divs with varying content on a webpage. Each of these dynamically created divs includes the class "entry". I am seeking a way to trigger a click event when any of these dynamically generated divs are clicked. ...

Why doesn't the date appear in the Textbox when the TextMode is set to "Date"?

Within my application, there are three textboxes named tbEditStartDate, tbEditStopDate, and tbEditRenewalDate. These textboxes are used to display the start date, stop date, and renewal date of applicants in a Gridview called gvApp. I have implemented a Ro ...

Ways to optimize images for social media sharing on a website

I am in the process of building a new website using Elementor and Wordpress. My goal is to incorporate multiple GIFs and images that users can easily share on social media platforms. The challenge I'm facing is that the social icons in Elementor are ...

Is it possible to resume CSS animation when the page is first loaded?

I'm looking for a way to ensure that my CSS animations on the elements in my header.php file continue smoothly when navigating to different pages. For example, if I have a 200-second looped animation and navigate to the "about us" page 80 seconds int ...

What is the best way to determine if an HTML element reaches the bottom of the browser window?

In this scenario, my div is intersecting the bottom of the page. How can I use JavaScript to determine if this element is intersecting with it or not? For example, if bottom:0px; should not be intersected. .fixed{ position:fixed; bottom:-10px; le ...

CSS is being applied on Internet Explorer 11 only after a hard refresh with Ctrl+F5

While my website loads perfectly in Chrome and Firefox, I have been experiencing issues with Internet Explorer 11. The CSS is not fully applying until after pressing Ctrl+F5 multiple times. It's strange because some of the CSS is being applied but cer ...

Properly appears in Chrome, but experiences issues in Internet Explorer 11

The design of the website looks seamless in Chrome and Firefox, however, when I view it in Internet Explorer, I notice a significant gap on the right side of the first two pages. How can I fix this issue specifically for Internet Explorer? Should I use a m ...

Inserting jQuery into a Div container

I am attempting to execute a jQuery function within a dynamically generated div (subpage) through JavaScript. I'm relatively new to this, so please bear with me. Within the index.html file, I am filling a div using a JavaScript load command. <ul& ...

Retrieve the source code of an HTML element

When you run this code, you will see the output as [object HTMLUListElement]: ul = document.createElement('ul'); $('textarea').val(ul) Is it possible to get the output as <ul></ul> directly? The following solution wo ...

What is the best way to deactivate an <a> tag in React after it has been clicked?

Is there a way to deactivate the anchor tag below in React once it has been clicked? The onClick function is not functioning on the anchor tag. <td align="left"> <input type="file" accept=".csv,.xlsx,.xls" ...

Tips for creating shaped images using clip-path

Can an image be clipped to match a specific shape using the clip-path CSS property? Original Image https://i.stack.imgur.com/rYeuk.jpg Desired Result with CSS https://i.stack.imgur.com/6FYfn.png ...

Retrieving form data from previous page using PHP mail function

Currently, I have a form that needs to be filled out on one PHP page with the following structure: <p> <label for="first_name">First Name: </label> <input type="text" size="30" name="first_name" id="first_name"/> </p> < ...

Pressing the 'enter' key will automatically submit the form

I am looking to automatically submit the form value when the 'enter' key is pressed. Currently, I have a search button that submits the form value, but I want to eliminate the need for the button and simply submit on enter key press. html ...

I am interested in implementing a feature that automatically saves form data when changes are made. My solution involves creating a dynamic form utilizing

When creating a dynamic form in HTML using Laravel and then calling it through JQuery, I encountered an issue where the first form created showed an undefined form ID, but subsequent forms displayed their form IDs. How can this issue be resolved? Below i ...