Flexbox not giving equal width to elements

Attempting a flexbox nav that has up to 5 items and as little as 3, but it’s not dividing the width equally between all the elements. Fiddle The tutorial I’m modeling this after is http://www.sitepoint.com/responsive-fluid-width-variable-item-navigation-css/ SASS * { font-size: 16px; } .tabs { max-width: 1010px; width: 100%; height: 5rem; border-bottom: solid 1px grey; margin: 0 … Read more

What’s the difference between align-content and align-items?

What is the difference between align-items and align-content? 14 s 14 The align-items property of flex-box aligns the items inside a flex container along the cross axis just like justify-content does along the main axis. (For the default flex-direction: row the cross axis corresponds to vertical and the main axis corresponds to horizontal. With flex-direction: … Read more

Align an element to bottom with flexbox

I have a div with some children: <div class=”content”> <h1>heading 1</h1> <h2>heading 2</h2> <p>Some more or less text</p> <a href=”https://stackoverflow.com/” class=”button”>Click me</a> </div> and I want the following layout: ——————- |heading 1 | |heading 2 | |paragraph text | |can have many | |rows | | | | | | | |link-button | ——————- Regardless … Read more

How can I make Flexbox children 100% height of their parent?

I’m trying to fill the vertical space of a flex item inside a Flexbox. .container { height: 200px; width: 500px; display: flex; flex-direction: row; } .flex-1 { width: 100px; background-color: blue; } .flex-2 { position: relative; flex: 1; background-color: red; } .flex-2-child { height: 100%; width: 100%; background-color: green; } <div class=”container”> <div class=”flex-1″></div> <div … Read more

Flexbox: center horizontally and vertically

How to center div horizontally, and vertically within the container using flexbox. In below example, I want each number below each other (in rows), which are centered horizontally. .flex-container { padding: 0; margin: 0; list-style: none; display: flex; align-items: center; justify-content: center; } row { width: 100%; } .flex-item { background: tomato; padding: 5px; width: … Read more

How to Right-align flex item?

Is there a more flexbox-ish way to right-align “Contact” than to use position: absolute? .main { display: flex; } .a, .b, .c { background: #efefef; border: 1px solid #999; } .b { flex: 1; text-align: center; } .c { position: absolute; right: 0; } <h2>With title</h2> <div class=”main”> <div class=”a”><a href=”#”>Home</a></div> <div class=”b”><a href=”#”>Some title … Read more