---
title: "How to align content of a div to the bottom?"  
description: "How to align content of a div to the bottom?"  
author: "Sandra Emily"  
published: 2024-06-05  
updated: 2024-06-06  
canonical: https://www.mindstick.com/forum/160689/how-to-align-content-of-a-div-to-the-bottom  
category: "css-css3"  
tags: ["css-css3", "css", "css styling"]  
reading_time: 3 minutes  

---

# How to align content of a div to the bottom?

How to align [content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) of a div to the bottom?

## Replies

### Reply by Ashutosh Patel

### Align div content to the bottom

To align the content of a div to the bottom, you can use the align-items property if the parent container is a flex container.

You can also use the position property if you want to align it with n its parent. Whether it's a flex container or not.

There are two methods to achieve this,

#### 1. Using flexbox (align-items)

## HTML

```html
<div class="container">
 <div class="content">
   <!-- Your content here -->
 </div>
</div>
```

## CSS

```css
.container {
 display: flex;
 align-items: flex-end; /* Align items to the bottom */
 height: 300px; /* Set height for demonstration */
}
```

#### 2. Using Positioning

## HTML

```html
<div class="container">
 <div class="content">
   <!-- Your content here -->
 </div>
</div>
```

## CSS

```css
.container {
    position: relative; /* Position the container */
    height: 300px; /* Set height for demonstration */
}
.content {
    position: absolute; /* Position the content */
    bottom: 0; /* Align the content to the bottom of the container */
}
```

Choose the method that best fits your layout and requirements. Flexbox is generally more flexible and easier to manage for aligning items within a container, especially if the layout is dynamic.

Positioning is useful for aligning content relative to its containing element, regardless of its relationship to other elements.

## Example-

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Right-align Flex Items</title>
  <style>
    /* Align bottom using Using Flexbox */
    .container {
      border: gray solid 1px;
      display: flex;
      align-items: flex-end; /* Align items to the bottom */
      height: 100px; /* Set height for demonstration */
    }
/* this is the contect display in the bottom using Positioning */
    .container-2 {
      border: gray solid 1px;
      position: relative; /* Position the container */
      height: 100px; /* Set height for demonstration */
    }
    .content-2 {
      position: absolute; /* Position the content */
      bottom: 0; /* Align the content to the bottom of the container */
    }
  </style>
</head>

<body>
  <h3>Align bottom using Flexbox</h3>
  <div class="container">
    <div class="content">
      <p>this is the contect display in the bottom</p>
    </div>
  </div>

  <h3>Align bottom using Positioning</h3>
  <div class="container-2">
    <div class="content-2">
      <p>this is the contect display in the bottom using Positioning</p>
    </div>
  </div>

</body>
</html>
```

## Output-

![How to align content of a div to the bottom?](https://www.mindstick.com/mindstickforums/00f164be-1187-434e-a79c-6d44b9228c99/images/84fe1a8e-cba8-49d2-911d-4669654aa417.jpg)


---

Original Source: https://www.mindstick.com/forum/160689/how-to-align-content-of-a-div-to-the-bottom

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
