Thursday, July 13, 2017

Get on the Flexbox Bandwagon

 
View online
sitepoint
 
Get on the Flexbox Bandwagon

When you need to place elements on your website, CSS flexbox is awesome. Equal columns, sticky footers, centering, and more are a breeze with flexbox.

For example, to center an element inside its parent both horizontally (the easy part) and vertically (the hard part), add this bit of code to the parent:

.parent {    display: flex;    justify-content: center;    align-items: center;  }  

Done, no hacks!

Because flexbox has excellent browser support, you can even use it as a valid fallback method for browsers that don't support Grid Layout, which today is the latest CSS standard for full page layouts.

If you haven't approached flexbox yet, I have a beginner-friendly introduction to flexbox to get you started in no time.

Are you already comfortable with flexbox? Then, you'll enjoy Building Mega Menus with Flexbox.

Get flexing!

Maria Antonietta Perna
HTML/CSS Channel Editor

 
 
 
 
 
 

No comments:

Post a Comment