Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

align-self: flex-end not moving item to bottom [duplicate]

Tags:

html

css

flexbox

As you can see here: JSFiddle

I want author div to be at the bottom of his parent container. I tried with align-self: flex-end; but it's not working. What am I doing wrong?

.flexbox {    display: flex;    flex-wrap: wrap;    justify-content: space-between;  }    .item {    display: flex;    flex-direction: column;    width: 100px;    border: 1px solid #000;    padding: 10px;  }    .item .author {    width: 100%;    align-self: flex-end;    border: 1px solid #000;  }
<div class="flexbox">      <div class="item">      <div class="title">        Title      </div>      <div class="content">        Content      </div>      <div class="author">        Author      </div>    </div>      <div class="item">      <div class="title">        Title      </div>      <div class="content">        Content<br>Content      </div>      <div class="author">        Author      </div>    </div>      <div class="item">      <div class="title">        Title      </div>      <div class="content">        Content<br>Content<br>Content      </div>      <div class="author">        Author      </div>    </div>    </div>
like image 805
user2490424 Avatar asked May 15 '17 08:05

user2490424


People also ask

Will align-self override align-items?

The align-self CSS property overrides a grid or flex item's align-items value. In Grid, it aligns the item inside the grid area. In Flexbox, it aligns the item on the cross axis.

How do you align buttons on flex-end?

Approach #1: Use align-self: flex-end on the button. This would make the button appear in the rightmost corner of your parent. Approach #2: In case you want more control over the position of the button in terms of alignment with the text area, you can wrap the button in a div and keep the float right on the button.


1 Answers

Try add to .author

margin-top: auto; 

You also need to remove flex-end.

like image 99
Alex Avatar answered Oct 08 '22 11:10

Alex