Flexbox Cheatsheet: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 4: | Line 4: | ||
</div> | </div> | ||
*REMEMBER: All Flexbox coding of items requires that they are inside of a container, such as a "div" or "p" tag: | *REMEMBER: All Flexbox coding of items requires that they are inside of a container, such as a "div" or "p" tag: <br> | ||
<div style="display:flex"> | <div style="border:2px solid green; padding:3px"> | ||
<div>Item 1</div> | <nowiki><div style="display:flex"></nowiki><br> | ||
<div>Item | <nowiki><div>Item 1</div></nowiki><br> | ||
<div>Item | <nowiki><div>Item 2</div></nowiki><br> | ||
</div> | <nowiki><div>Item 3</div></nowiki><br> | ||
<nowiki></div></nowiki></div><br> | |||
<table style="max-width:1200px; border:2px solid green" class="sortable"> | <table style="max-width:1200px; border:2px solid green" class="sortable"> | ||
<tr style="background:#FFE4B5"> | <tr style="background:#FFE4B5"> |
Revision as of 09:09, 28 December 2016
FLEXBOX CHEATSHEET
Condensed guide to Wikitext coding
Condensed guide to Wikitext coding
Click on sort icon to put list in alphabetical order
- REMEMBER: All Flexbox coding of items requires that they are inside of a container, such as a "div" or "p" tag:
<div style="display:flex">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
Description | Flex coding | You Get |
---|---|---|
Placing objects in rows | display:flex |
1
2
3
|
Placing objects at end of containers | justify-content:flex-end |
1
2
3
|
Placing objects in the center of containers | justify-content:center |
1
2
3
|
Placing objects evenly spaced across a containter | justify-content:space-between |
1
2
3
|
Evenly spacing objects with space on either end | justify-content:space-around |
1
2
3
|
Placing objects at end of containers | flex:# |
1
2
3
|
Different flex numbers | Different flex numbers |
1
2
3
|
flex zero | Box one with flex number zero |
1
2
3
|
Change order in row | order:# |
1
2
3
|
Wrapping boxes in limited space | flex-wrap:wrap |
1
2
3
|
Placing objects in a column | flex-direction:column |
1
2
3
|
Centering horizontally | display;flex; justify-content:center Place on each line where you want to center text or image horizontally |
1
2
3
|
Centering vertically | display:flex; align-items:center Place on each line where you want to center text or image vertically |
1
2
3
|
Centering vertically & Horizontally | display:flex; justify-content:center; align-items:center Place on each line where you want to center text or image vertically |
1
2
3
|
Placing objects at opposite ends of containers | White box with flex:6 between items 1 and 2 |
1
2
3
|