What is the Best Way to Line Up Divs of Varying Heights?

I'm struggling with aligning my divs properly. The issue I am facing is that my divs adjust their height based on the content within them, which is causing alignment problems.

Below is a picture illustrating the current situation:

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

You'll notice that the "prince" post is correctly aligned to the right, but the subsequent post appears below it instead of lining up next to it. I can't seem to identify what's causing this misalignment.

Here is the section of my HTML code in question:

<div class="row" style="padding:30px 10px 30px 20px; margin:auto;  display:block;">

 <div class="large-12 column large-columnz">
 <a href="post url"><img src=""></a>
 <div class="row column">The Title
 Article Excerpt</div>
</div>
</div>
</div>

And here is the relevant CSS code:

.large-columnz {  
    max-width:560px;
    margin-bottom:10px;
    display: inline-block;
    vertical-align: top;
    *display: inline;
 }

I am utilizing the Foundation responsive framework for my website design, along with custom CSS.

If anyone can offer insight into why the last two posts are not aligning properly, I would greatly appreciate it.

Answer №1

Place a parent container around all existing divs (if there isn't one already) and apply the style display: flex; to the parent container. This will ensure that all child elements within it will have uniform height.

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

Ways to emphasize the contrast between two texts using CSS

One method to highlight specific parts of text using CSS can be found in this script: span.highlight { background-color: #B4D5FF; } However, what if we want to highlight the differences between two strings? Take for example these two strings: this ...

Emphasize the cell in the initial column to indicate the resulting or winning selection

Having trouble sharing my code directly, so please check out the JSFiddle link to see it in action. Once you click the "Click to Draw a Winner" button, a winner will be randomly selected after 10 seconds. The only issue is that currently only the winning b ...

How to make text dynamically shrink with TailwindCSS class 'flex-shrink-0'

I've designed an 'Album' (React) component to showcase album artwork, name, and release date in a card-like format. This component consists of two divs - one for the photo and the other for text. Each artist's discography displays multi ...

Is there a way to make a table stay at a specific width for screen sizes larger than 1000px, but then adjust its size accordingly as the window size decreases?

<table id="example" class="row-border compact" style="width:1000px; table-layout:fixed;"> The table is currently set to have a width of 1000px, but I would like it to be 90% of the screen width when the window size is less than 1000px. Is it possibl ...

Unavailability of certain CSS rules

I have integrated a Bootstrap jumbotron as the header for my webpage and have my own custom layout.css file. However, not all the styling rules defined for the .jumbotron class seem to be working. Despite setting margin-bottom: 0px;, it does not reflect in ...

json_encode has stopped functioning (now)

Recently, I encountered a strange issue. I've been trying to display chart data, but the JSON_ENCODE function that is supposed to convert my data into JSON format is not returning anything. It was working fine before when I had less data, but now it&a ...

Exploring Browser History using Cascading Style Sheets

Currently, I am in need of researching a topic for my University project. Unfortunately, the internet has not provided me with any information on this specific subject. The task at hand is as follows: "How and under what circumstances can one uncover ...

"Is it possible to create a custom rounded radius for CSS elements

Is it possible to achieve a custom border radius similar to the hero image on this website: I understand that the effect is achieved with the image itself, but I'm wondering if something similar can be done using CSS? ...

The resizing issue of Textarea during transitions

Whenever I add the transition property to a textarea, it automatically affects the resizing function of the textarea. Is it possible to disable the transition only when resizing the textarea, but not for the textarea itself? <textarea name="" id="" cla ...

Update table content dynamically without the need to refresh the entire page while maintaining the original CSS

I have been encountering an issue with my ASP .NET code. I have spent hours researching but haven't found a solution that works for me. My problem is that when I click a button, the text inside a textbox should be added to a dropdown and update a tabl ...

Aligning a checkbox vertically with other input elements using bootstrap

I have been struggling to center a Bootstrap-styled checkbox component within my form. Despite trying various margin sizes with the mt class, I have not been successful in achieving the desired centering effect when compared to a text input. Here is my cu ...

The ease of use and availability of radio buttons

When clicking on the first or second value of the radio button, it selects the first option. Here is the HTML code: @supports(-webkit-appearance: none) or (-moz-appearance: none) { input[type='radio'], input[type='checkbox'] { ...

Capture a snapshot of a webpage that includes an embedded iframe

Currently, we have a nodeJS/angular 4 website that contains an iframe from a third party (powerBI Emebdded). Our goal is to develop a feature that allows the end user to capture a screenshot of the entire page, including the content within the iframe. We ...

Tips for displaying a multi-select dropdown in the Creative Tim Angular Material Pro filter panel

I am in need of assistance with modifying the standard Creative Tim Angular Pro Material template due to my limited CSS/SCSS skills. Could someone provide examples of the necessary changes, whether it involves altering the HTML or multiple CSS files withi ...

Creating artwork using a "graphite drawing tool" on a blank canvas

I created a script that draws a series of lines on a canvas, giving it a sketch-like appearance. However, I have encountered two issues with the script. Firstly, why is the y value appearing to be twice as much as it should be? Secondly, why is the line w ...

Identify the moment the user begins or ends typing using jQuery

Once upon a time, I encountered an issue that required me to detect when a user was typing and when they stopped typing so I could update the status accordingly. I have created a simple solution that may work for you as well. var typingTimer; var doneTyp ...

Choose an option with JavaScript once the request is successful

Choose the day, month, and year using JSON data success: function(jsondata){ var data=JSON.parse(jsondata); var list_html="<div id='editrelation'><label id='dateLabel' style='display:none&apo ...

Optimal method for integrating Google Font in GWT application

After successfully installing the Roboto font on my machine, I proceeded to include it in my welcome.html file by adding the following code: <link href='http://fonts.googleapis.com/css?family=Roboto:regular,medium,bold,thin' rel='stylesh ...

Content is not being contained within a div container

I'm facing a unique issue that I've never encountered before - text is not wrapping inside a div element. Here's a snippet of my HTML code: http://jsfiddle.net/NDND2/2/ <div id="calendar_container"> <div id="events_container"& ...

What causes a span with absolute positioning to not be correctly positioned within a span with relative positioning in Firefox, unless it is displayed as inline-block or similar?

Can you explain why the code below doesn't display correctly in Firefox unless the parent span is set to display as inline-block? When inspecting the layout of the absolutely positioned span, it shows the number 184 instead of 197 on the right side. A ...