Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Flex Box Support / Percentage Padding Bug

Hi everyone!

This is less of a question more of a snippet of info.

Taking my time and experimenting with many aspects of flex box I have come across an area that can be an issue not described on Can I Use.

For the reason that treehouse has helped me to learn approximately everything I know about web design I thought I'd share the info.

Flex Box Navigation:

Using flex box simply for your nav would be a great idea as it holds the key to easy fluid design with very little effort in comparison to other methods.

There is however one thing to watch out for and that is percentages.

When you declare your nav element as a flex container all the ul elements become flex items, once the declaration to the flex container has been made the items have inherited a number of default styles that can need addressing.

For example in connection with Navigation Element List Items Containing more than one word i.e "Website Designer":

Percentage margins and padding need to be avoided on the flex items as it causes the list item attribute to wrap seemingly when it fancies, see bellow.

Percentage Padding .... http://codepen.io/Craig-Watson/full/QwGKrM/

Resizing the viewing window will show you the problem, as codepen refreshes constantly you dont get the full extent of the problem but should you whip the code to a local file and view in a browser full screen its clear this is not good.

Solution:

Fixed Pixel Padding .... http://codepen.io/Craig-Watson/full/emBrbj/

Simple but affective!

Flex Wrap is one of the main advantages for page layout and is a fantastic tool to have, but in this case needs fixed pixels to hold it together.

It is worth knowing this info as there may be other times when % padding and margin causes layout mishaps, being aware that its as simple as a fixed pixel to prevent may save you lots of time! Then just let flex box handle the rest.

Here are two links to expand your knowledge of flex box should you wish to do so!!!

http://css-tricks.com/snippets/css/a-guide-to-flexbox/

http://caniuse.com/#feat=flexbox

All comments are welcome unless they are uselessly negative... !

Hope this helps a little Craig