STEP 1 HTML/CSS - CSS layout - learnlayout ë§ëŹ´ëŚŹ (flexbox)
flexbox froggy ę˛ě
(1) display: flex
(2) flex-direction: row / row-reverse / column / column-reverse;
(3) flex-wrap: nowrap / wrap / wrap-reverseâ;
(4) flex-flow: (=flex-direction ę°) (flex-wrap ę°);
(5) â justify-content: flex-start(기본ę°) / flex-end / center / space-around / space-evenly / space-between;
(6) â align-content: stretch(기본ę°) / flex-start / flex-end / center / space-around / space-evenly / space-between;
flex-wrap
ěěąě ě¤ě í´ itemě´ 2ě¤ ě´ěě´ęł ěŹë°ąě´ ěě 경ě°ěë§ ěŹěŠ ę°ëĽ(7) â align-items: stretch(기본ę°) / flex-start / flex-end / center / baseline(돸ě 기ě¤ě ě ě ë Ź);
ěŚ, 'align-content'ë ěŹëŹ ě¤ë¤ ěŹě´ě ę°ę˛Šě ě§ě í늰, 'align-items'ë 읨í ě´ë ěěě ě´ëťę˛ 모ë ěěë¤ě´ ě ë Źíëě§ëĽź ě§ě íë¤. í ě¤ë§ ěë 경ě°, align-contentë í¨ęłźëĽź ëł´ě´ě§ ěëë¤.
기본
.container>.item.item$*10{$} ë ë˛ ë°ëłľ
.container { height: 80vh; background-color: bisque; display: flex; /* ęł ë ¤í´ěź í ěě 1) ě¤ěŹěś or ęľě°¨ěś 2) ěěě or ëě */ flex-direction: row; flex-wrap: wrap; /* ěë 기본ę°ě nowrap */ justify-content: flex-start; align-items: stretch; align-content: stretch; } .item { width: 100px; height: 50px; margin: 10px; /* align-content ěěąě ěŹěŠí기 ěí´ ě¤ě í ěŹë°ą */ }
cf.
.container {height: 80vh;}
ě
html, body {height: 100%;} .container {height: 80%;}
ë ę°ë¤
(1) order: ...-2, -1 , 0(기본ę°), 1, 2...;
(2) flex-grow: 0(기본ę°) ,1 ,2...;
(3) flex-shrink: 1(기본ę°), 2, 3...;
(4) flex-basis
auto(기본ę°);
ěź ë, flex-growě flex-shrinkě ë§ěś°ě itemě íŹę¸°ę° ëłę˛˝ë¨%;
ěź ë, ě´ ëšě¨ě ë§ěś°ě itemě íŹę¸°ę° ëłę˛˝ë¨(5) flex: (flex-grow ę°) (flex-shrink ę°) (flex-basis ę°);
flex: 1;
= flex: 1 1;
= flex: 1 1 0;
â flex: 1 1 auto;
flex: initial;
=flex: 0 1 auto;
flex: auto;
=flex: 1 1 auto;
flex: none;
=flex: 0 0 auto;
(6) align-self: center / baseline;
align-items
ëł´ë¤ ě°ě ě ěŠëë¤flexbox뼟 ě´ěŠí ę°ë¨í ë ě´ěě
.container1 { display: flex; margin: 10px; } container > * { border: 5px solid palevioletred; } nav { width: 200px; } section { flex: 1; }
flexbox뼟 ě´ěŠí ëŠě§ ë ě´ěě
.container2 { display: flex; margin: 10px; } .container2 > * { border: 5px solid olivedrab; } .initial { flex: initial; width: 300px; min-width: 100px; } .none { flex: none; width: 300px; } .flex1 { flex: 1; } .flex2 { flex: 2; }
flexbox뼟 ě´ěŠí ě¤ě ě ë Ź
.container3 { display: flex; margin: 10px; height: 300px; border: 5px solid brown; justify-content: center; align-items: center; /* container ěě itemě´ 1ě¤ ěěźëęš align-items ě ěŠ*/ } .container3>div { border: 5px solid hotpink; }
Google Clone
STEP 1 HTML/CSS ëłľěľ (layout ě죟)