Aligning to bottom of List Item using Flexbox


Aligning <span> to bottom of List Item using Flexbox



I have a horizontal list for navigation items, and each navigation item can have a "small text" area and a "large" text area, using <span> tags. So for example, the end result should look like this:


<span>



enter image description here



Notice the last navigation item has no "small text" section, and it aligns with the bottom areas of the navigation. Currently, my code looks like this:



navigation.scss


.nav {
align-items: center;
display: flex;
height: 100%;
margin-left: 5em;

ul {
display: flex;
flex-direction: row;
margin-top: auto;

li {
cursor: pointer;
display: flex;
flex-direction: column;
height: 65px;
list-style: none;
margin: .25em;
margin-bottom: auto;
padding: .65em 1.5em 1.5em 1.5em;
position: relative;
text-align: left;
white-space: nowrap;

span:first-child {
font-size: .75em;
font-weight: 500;
text-transform: uppercase;
}

span:nth-child(2) {
font-size: 1.15em;
font-weight: 600;
margin-top: auto;
}
}
}
}



navigation.html





With this code, the last navigation item "NUMBER THREE" does not align with the bottom text in the other two navigation items. It aligns it either with the middle or the top of the <li> item. I tried using aligning via flex-end and that did not do the trick. The end goal is to align the second <span> tag to the bottom so it aligns with the other navigation items. Does anyone have any ideas of how to align I am using flexbox with SASS (SCSS) in an Angular app.


<li>


flex-end


<span>



Thanks.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV