---
title: "How to Right-align flex item?"  
description: "How to Right-align flex item?"  
author: "Sandra Emily"  
published: 2024-06-06  
updated: 2024-06-06  
canonical: https://www.mindstick.com/forum/160690/how-to-right-align-flex-item  
category: "css-css3"  
tags: ["css-css3", "css", "css styling"]  
reading_time: 1 minute  

---

# How to Right-align flex item?

How to [Right](https://www.mindstick.com/articles/12766/check-whether-you-are-doing-digital-transformation-right-or-not)-align flex [item](https://www.mindstick.com/forum/156564/remove-item-in-an-array-in-javascript)?

## Replies

### Reply by Ashutosh Patel

### Right-align flex item

You can use the `justify-content` property with the value `flex-end` to align flex items to the right within a flex container on the flex container.

## Example-

```css
.container {
 display: flex;
 justify-content: flex-end;
}
```

This CSS code will align flex items to the right within a flex container. You can apply the `.container` class to the parent element that contains the flex items you want to align to the right.

## 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>
    /* css for align right the item */
    .container {
      display: flex;
      justify-content: flex-end;
      border: 1px solid #ccc;
      padding: 10px;
    }

    /* styling the flex item */
    .item {
      background-color: lightblue;
      padding: 10px;
      margin: 5px;
    }
  </style>
</head>

<body>

  <div class="container">
    <div class="item">Item 1</div>
    <div class="item">Item 2</div>
    <div class="item">Item 3</div>
  </div>

</body>
</html>
```

## Output-

![How to Right-align flex item?](https://www.mindstick.com/mindstickforums/058cd7f4-21f4-4b4f-9c55-1c4875339651/images/2e42fc41-7fe0-4a49-b55d-433d9cfc636b.jpg)

**Also, Read:** [How to align content of a div to the bottom?](https://www.mindstick.com/forum/160689/how-to-align-content-of-a-div-to-the-bottom)


---

Original Source: https://www.mindstick.com/forum/160690/how-to-right-align-flex-item

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
