Position multiple div elements at the top with CSS alignment

Hey there! I have a question about the HTML and CSS code snippet below. I'm trying to align the text in the <h2> tags at the top for all three

<div class="article-col-3">
containers, but it's currently aligned at the bottom. As I'm still getting the hang of CSS, some things are a bit tricky for me to figure out. I've included a link to the jsfiddle example as well as the relevant code snippet below. I've tried a few different options already, but maybe there's a simple way to extend the existing code to achieve the desired alignment.

Any help would be greatly appreciated!

.article {
  text-align: center;
  padding: 20px;
}

.article-col {
  margin-top: 50px;
  margin-bottom: 50px;
}

.article-col-3 {
  display: inline-block;
  padding-left: 10px;
  padding-right: 10px;
  width: 23%;
  height: 100%;
}

h2 {
  font-size: 16px;
}
<div class="article">
Some pre text that might be placed here. Nothing special at all, but the next stuff should be displayed in three columns and each headline should start at the top and not at aligned at the bottom.
<div class="article-col">
<div class="article-col-3">
<h2>Part 1</h2>
<p>Sub-Text Passage</p>
</div>
<div class="article-col-3">
<h2>Part 2</h2>
<p>Sub-Text Passage</p>
</div>
<div class="article-col-3">
<h2>Part 3</h2>
<p>Sub-Text Passage which might be a bit longer and thus, the other went down</p>
</div>
</div>
</div>

Check out the example on JSFiddle.

Answer №1

consider incorporating the display: flex; property into your .article-col class for better layout alignment

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 are the solutions to repair a triple drop-down menu?

I am struggling with the code below which contains numbers inside the values: What I need is to modify all instances of the following codes: <option value="1" class="sub_1"> To look like this: <option value="" id="1" class="sub_1"> Basical ...

In Vue, it is not accurate to measure overflow

I am working on creating an overflow effect with tagging that fades out at the beginning to provide a subtle hint to users that there is more content. Here is what it currently looks like: https://i.stack.imgur.com/fXGBR.png To achieve this, I added a fa ...

Is there a way to apply a class to the main div once the checkbox has been clicked?

Whenever the checkbox is checked, it should add a class to the main div. Additionally, if I try to check another checkbox, the previously checked one should have its class removed and the new one should have the class added. Here is the code snippet for r ...

Struggling to contain the image inside my div element

I'm having trouble with keeping the image inside my div element as it keeps stretching outside of it. I've tried researching for a solution but haven't been successful in finding one. Any help would be greatly appreciated! Here is the HTML/ ...

Using Selenium IDE to click on a checkbox within a table row

Currently, I am utilizing Selenium IDE to navigate through a table with multiple rows and columns. Each row within the table contains its own checkbox for selection purposes. In my attempt to search for a specific row, I have been using the following comm ...

Leverage scope variables and dynamic CSS properties when using ngClass

Is there a way to manipulate the CSS dynamically in HTML using a scope variable? <div ng-class="myClassScope, { 'dynamic-class': !ifIsNot }"> ...

The Angular Material Nav Sidebar is specifically designed to appear only when resizing the screen to

I am currently following a tutorial on setting up Angular Material Sidenav with a toolbar from this video (https://www.youtube.com/watch?v=Q6qhzG7mObU). However, I am encountering an issue where the layout only takes effect after resizing the page. I am no ...

The art of fluidly positioning elements in Bootstrap columns

My goal is to showcase objects in 3 columns using Bootstrap 4. However, when I implement the code provided, the objects are only displayed in a single column, as shown here: example of 1 column layout. What I actually want is for the objects to be arrange ...

Struggling with CSS float problems

I'm currently working with the Pure CSS framework and my code resembles this: <div class="container pure-g"> <header class='pure-u-1'> <h1 class='logo'> <a href="#">TEST</a> </h1> &l ...

Use CSS3 and jQuery.validate to highlight mandatory fields in red

I've been attempting to change the color of required fields in a form to red, but so far I haven't had any success. Here is the form code and the CSS that I have experimented with. contact.html <h2>Send us an ...

I can't seem to get my SVG data URL located inside an HTML file within an SVG data URL to display in Chrome

Background I am encountering an issue where an SVG data URL used as a background image property inside an HTML element within a <foreignObject> nested within an SVG data URL is not rendering properly in Google Chrome. If this structure was outside o ...

What is the process for creating a div and its children without inheriting the styles of its parent?

Imagine having the following structure: <div class="building"> <p>...</p> <div class="room"> <p>...</p> </div> </div> <div class="building"> <p>...</p> <div class="room ba ...

Entire body encompassing table

I am trying to create an HTML page with a table that spans the entire body and displays scrollbars when needed for both horizontal and vertical scrolling. Here is my current styling for the table: table { box-shadow: inset 0 0 10px #000; position: ...

What is the best way to position a background image at the top of a div without overlapping the

I have this HTML code: <div class="page"> <div id="header"> ... </div> </div> Below is my CSS: .page { width: 1028px; background-color:#103250; margin-left: auto; margin-right: auto; } ...

Is there a way to set a max-width using a Pseudo class

I am utilizing a css tooltip that is linked to a span element in the following manner: <span class="mytooltip" data-mytooltip="Text here. Text here. Text here. Text here. Text here. Text here. Text here. Text here. Text here."> Has Tooltip </ ...

Align the items in the Bootstrap navbar to the right using float

Can someone provide guidance on how to float navbar items to the right instead of the left? I have tried using the floats and float-right classes, but it seems that pull-right is deprecated. Any help would be greatly appreciated. <header class="conta ...

What causes the iframe to protrude beyond the bottom of the page when set to 100% height?

I am facing an issue with an iframe on my website that is contained within a div. I have specified both to have a height of 100%, and I am using the blueprint framework, hence applying the class span-12 last. Despite these settings, a scroll bar still appe ...

I cannot locate the dropdown list anywhere

As a beginner in html and css, I decided to follow a tutorial on youtube. The tutorial focuses on creating a navigation bar with dropdown menus using html and css. I wanted the names Ria, Kezia, and Gelia to be displayed when hovering my mouse over the Su ...

What is the process for incorporating a personalized SVG file into the material-ui Icon Component?

For my project, I have a requirement to use custom svg files. To achieve this, I am utilizing <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0865697c6d7a616964257d61483b2631263b">[email protected]</a>. I reviewed ...

Is there a way to display images in Vuetify similar to the linked image below?

I am looking to measure my v-img like the one shown in the image below. https://i.stack.imgur.com/edMKr.jpg Does anyone know how I can achieve something similar to the image shown using vuetify's v-img. <div class="row"> <v ...