day9

์ƒ์€๐Ÿ‘ธยท2023๋…„ 10์›” 18์ผ
1

๋šœ๋ฒ…๋šœ๋ฒ… ๋‘๋ฒˆ์งธ

๋ชฉ๋ก ๋ณด๊ธฐ
5/13
post-thumbnail
post-custom-banner

๐Ÿ“Œ์ •๋ฆฌ

  • align-items๋ž‘ ๊ฐ™์ด์“ฐ๋ฉด align-content๊ฐ€ ์žก์•„๋จน๋Š”๋‹ค

  • flex๋Š” ์•ˆ์— ์žˆ๋Š” ๋ฐ•์Šค๋“ค์„ ํ•œ์ค„์— ์ญ‰ ์ขŒ์šฐ๋ฐฐ์น˜ ํ•ด์ฃผ๋Š” ์šฉ๋„!! ๊ทธ๋ž˜์„œ flex ์•ˆ๊ฑธ์–ด์ฃผ๋ฉด ๋ฐ•์Šค ํ•˜๋‚˜๋Š” ๋‹ค์Œ์ค„๋กœ ๋„˜์–ด๊ฐ„๋‹ค

๐Ÿ“– flex

1. inline-flex

flex : ๋‚ด๋ถ€๋ฅผ flex ์ •๋ ฌ
inline-flex : ๋‚ด๋ถ€๋ฅผ flex / ๋‚ด ์ž์ฒด inline

2. flex: 1; ๐Ÿšจflex ์•„์ดํ…œ์— ๊ฑธ์–ด์ค€๋‹ค!!!!๐Ÿšจ

flex: 1; ๊ฐ์ž ์ฐจ์ง€ํ•˜๋Š” ๋น„์œจ!!!!!
flex ์•„์ดํ…œ์— ๊ฑธ์–ด์ค€๋‹ค!!!!
container์— display: flex; ๊ฑธ์–ด๋’€์œผ๋ฉด
๊ฐ์ž box๋งˆ๋‹ค flex: 1; ์„ ๊ฑธ์–ด์ค€๋‹ค!

๐Ÿ“– grid

1. grid ๋ ˆ์ด์•„์›ƒ์˜ ๊ตฌ์„ฑ

๐Ÿšจcontainer์— ๊ฑธ์–ด๋‘”๋‹ค
=> ๋จผ์ € display: grid; ๋„ฃ์–ด๋†“๊ณ  ์‚ฌ์šฉ!! flex๋ž‘ ๋˜‘๊ฐ™์€ ์ด์น˜

grid-template-rows: 100px 100px; //100px์งœ๋ฆฌ 2ํ–‰
grid-template-columns: 100px 100px 100px; //100px์งœ๋ฆฌ 3์—ด

2. ํ–‰๊ณผ ์—ด์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ

๐Ÿšจcontainer์— ๊ฑธ์–ด๋‘”๋‹ค

row-gap: 10px;
column-gap: 20px;

3. ํ–‰/์—ด ๋ณ‘ํ•ฉ

๐Ÿšจ๋ณ‘ํ•ฉํ•˜๊ณ ์‹ถ์€ ๋ฐ•์Šค์— ํด๋ž˜์Šค ํ•˜๋‚˜ ๋” ๋งŒ๋“ค์–ด์„œ ๊ฑธ์–ด๋‘”๋‹ค

grid-row-start: ํ•ด๋‹น์š”์†Œ ์‹œ์ž‘ ๋ผ์ธ ๋ฒˆํ˜ธ (ํ–‰)
grid-row-end: ํ•ด๋‹น์š”์†Œ ๋ ๋ผ์ธ ๋ฒˆํ˜ธ

= grid-row: 1 / 3; ํ•œ์ค„๋กœ!
/ ํ–‰ 1๋ฒˆ๋ผ์ธ๋ถ€ํ„ฐ 3๋ฒˆ๋ผ์ธ๊นŒ์ง€ ๋ณ‘ํ•ฉ!/

=grid-row:1 / span 2;
/ ํ–‰ 1๋ฒˆ๋ผ์ธ๋ถ€ํ„ฐ 2์ค„ !!!!/
/////////////////////////////////////////////////

grid-column-start: ํ•ด๋‹น์š”์†Œ ์‹œ์ž‘ ๋ผ์ธ ๋ฒˆํ˜ธ (์—ด)
grid-column-end: ํ•ด๋‹น์š”์†Œ ๋ ๋ผ์ธ ๋ฒˆํ˜ธ

= grid-column: 3 / 4; ํ•œ์ค„๋กœ!
/ ์—ด 3๋ฒˆ๋ผ์ธ๋ถ€ํ„ฐ 4๋ฒˆ๋ผ์ธ๊นŒ์ง€ ๋ณ‘ํ•ฉ!/

= grid-column : 3 / span 1;
/ ์—ด 3๋ฒˆ๋ผ์ธ๋ถ€ํ„ฐ 1์ค„ !!!!/

4. ๊ตฌ์กฐ ํ…œํ”Œ๋ฆฟ

=> ๋จผ์ € ์ปจํ…Œ์ด๋„ˆ์— display: grid; ๊ฑธ์–ด์ฃผ๊ณ !!!

๐Ÿšจcontainer์— ๊ฑธ์–ด์ค€๋‹ค
grid-templete-areas:

๐Ÿšจ๊ฐ๊ฐ ๋ฐ•์Šค์— ๊ฑธ์–ด์ค€๋‹ค(์ด๋ฆ„์ •ํ•˜๋Š”๊ฑฐ์•ผ)
grid-areas:

1) grid-templete-areas:

๐Ÿšจcontainer์— ๊ฑธ์–ด์ค€๋‹ค
๐Ÿšจ"nav nav nav"
"main main aside"
"main main aside"
"footer footer footer"
;
์ด๋Ÿฐ์‹์œผ๋กœ 4ํ–‰ 3์—ด ์ •ํ•˜๋“ฏ์ด ํ–‰ ์—ด ์ˆœ์„œ๋Œ€๋กœ ์ž‘์„ฑํ•œ๋‹ค!

2) grid-areas:

๐Ÿšจ๊ฐ๊ฐ ๋ฐ•์Šค์— ๊ฑธ์–ด์ค€๋‹ค(์ด๋ฆ„์ •ํ•˜๋Š”๊ฑฐ์•ผ)

.container {
     display: grid;

     grid-template-rows: 100px 100px 100px 100px;
     grid-template-columns: 100px 100px 100px;

     grid-template-areas: /*4ํ–‰ 3์—ด*/
        "nav nav nav"
        "main main aside"
        "main main aside"
        "footer footer footer"
        ;
      }

#nav {
	grid-area: nav;
    background-color: red;
}

#main {
     grid-area: main;
     background-color: orange;
}

#aside {
     grid-area: aside;
     background-color: green;
}

#footer {
      grid-area: footer;
      background-color: blue;
}
<div class="container">
        
             <div id="nav"></div>
   <div id="main"></div>   <div id="aside"></div>
             <div id="footer"></div>
</div>

=> ๐Ÿ’ป

=> 100px 4ํ–‰ 100px 3์—ด์งœ๋ฆฌ๊ฐ€ ์ƒ์„ฑ๋˜๊ณ  ๊ฐ๊ฐ ์ด๋ฆ„๋„ฃ์–ด์ค€๋Œ€๋กœ ๋ฐ•์Šค๊ฐ€ ๋“ค์–ด๊ฐ„๋‹ค!

๐Ÿ“– mediaquary => ๋ฐ˜์‘ํ˜• ์›น

@keyframes์™€ ๊ฐ™์ด

@media only screen and (max-width: 800px)
===> 80~90%๊ฐ€ ์ด๋ ‡๊ฒŒ ์‚ฌ์šฉ!

1)

ํ•˜๋˜๋ฐ๋กœ ๋นจ๊ฐ„๋ฐ•์Šค ํ•˜๋‚˜ ๋งŒ๋“ค์–ด์ฃผ๊ณ  ๋นจ๊ฐ„๋ฐ•์Šค ์•ˆ์— ๋ฉ”์ธ,์„œ๋ธŒ,๋‚ด์šฉ ๊ธ€์„ ๊ฐ๊ฐ ๋„ฃ์–ด์ค€๋‹ค

.box {
	width: 300px;
    height: 300px;
    background-color: red;
}

.main-title {
    font-size: 30px;
    font-weight: bold;
    color: white;
}

.sub-title {
    font-size: 20px;
    color: lightgray;
}

.content {
     font-size: 16px;
}
<div class="box">
	<p class="main-title">๋ฉ”์ธํƒ€์ดํ‹€</p>
    <p class="sub-title">์„œ๋ธŒํƒ€์ดํ‹€</p>
    <p class="content">Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae voluptatum eveniet minus repellat recusandae consectetur mollitia quaerat, culpa inventore a omnis dolor, nemo enim est eos sequi placeat, blanditiis porro.</p>
</div>

2)

/* ํ˜„์žฌ ๊ฐ€๋กœ 495px */
@media only screen and (max-width: 310px) {
	/* ๊ฐ€๋กœ๊ฐ€ 310px์ด ๋์„๋•Œ */
    /* css ์Šคํƒ€์ผ ์ ์šฉ */
    .box {
    	width: 200px;
        height: 200px;
    }

    .main-title { font-size: 24px; }
    .sub-title { font-size: 14px; }
    .content { font-size: 10px; }
}

@media only screen and (max-width: 260px) {
	/* ๊ฐ€๋กœ๊ฐ€ 260px์ด ๋์„๋•Œ */
    /* css ์Šคํƒ€์ผ ์ ์šฉ */
    .box {
    	width: 150px;
        height: 150px;
        background-color: orange;
    }

    .main-title { font-size: 18px; }
    .sub-title { font-size: 10px; }
    .content { font-size: 8px; }
}

=> css๋ถ€๋ถ„์— @media only screen and (max-width: 310px)์™€ @media only screen and (max-width: 260px) ๋ฅผ ์ถ”๊ฐ€ํ•ด์ค€๋‹ค!
๊ทธ๋ฆฌ๊ณ  ๊ฐ๊ฐ ์•ˆ์— ํฌ๊ธฐ๋ฅผ ์ค„์˜€์„๋•Œ (310px, 260px) ๋“ค์–ด๊ฐˆ ๋‚ด์šฉ์„ .box{} ์ด๋Ÿฐ์‹์œผ๋กœ ๋„ฃ์–ด์ค€๋‹ค
๊ทธ๋Ÿฌ๋ฉด ๋ฐ•์Šคํฌ๊ธฐ๋ฅผ ์ค„์˜€์„๋•Œ๋„ ํ…์ŠคํŠธ๋„ ๊ทธ์— ๋งž๊ฒŒ ์ค„์–ด๋“ ๋‹ค!

=> ๐Ÿ’ป

3) ๊ธ€์žํฌ๊ธฐ ๋‹ค๋ฅด๊ฒŒ ํ‘œํ˜„!

.box {
	width: 300px;
    height: 300px;
    background-color: red;
}

.main-title {
	/* em rem : ์ƒ๋Œ€ ๋น„์œจ
    em : ๋ถ€๋ชจ์˜ font-size ๊ธฐ์ค€ ๋Œ€๋น„ ๋น„์œจ
    rem : ๊ธฐ๋ณธ html font-size ๊ธฐ์ค€ ๋Œ€๋น„ ๋น„์œจ */
    font-size: 1.8rem; /*๊ธฐ๋ณธ์‚ฌ์ด์ฆˆ์˜ 1.8๋ฐฐ*/
    font-weight: bold;
    color: white;
}

.sub-title {
    font-size: 1.4rem; /*๊ธฐ๋ณธ์‚ฌ์ด์ฆˆ์˜ 1.6๋ฐฐ*/
    color: lightgray;
}

.content {
    font-size: 1rem; /*๊ธฐ๋ณธ์‚ฌ์ด์ฆˆ*/
}

 /* ํ˜„์žฌ ๊ฐ€๋กœ 495px */
@media only screen and (max-width: 310px) {
	/* ๊ฐ€๋กœ๊ฐ€ 310px์ด ๋์„๋•Œ */
    /* css ์Šคํƒ€์ผ ์ ์šฉ */
    .box {
    	width: 200px;
        height: 200px;
    }

    html {
        font-size: 10px; /*๊ธฐ๋ณธ์‚ฌ์ด์ฆˆ ์ž์ฒด๋ฅผ ์ž‘๊ฒŒ ํ•ด๋†“์œผ๋ฉด ๊ทธ๋Œ€๋กœ ์‚ฌ์ด์ฆˆ๊ฐ€ ์กฐ์ ˆ์ด ๋˜๊ฒ ์ง€ ์œ„์—์„œ!!!*/
    }
}

@media only screen and (max-width: 260px) {
     /* ๊ฐ€๋กœ๊ฐ€ 260px์ด ๋์„๋•Œ */
     /* css ์Šคํƒ€์ผ ์ ์šฉ */
	 .box {
     	width: 150px;
        height: 150px;
        background-color: orange;
     }

     html {
       font-size: 8px; 
     }
}

=> ํฐํŠธ์‚ฌ์ด์ฆˆ๋ฅผ ๊ฐ๊ฐ ๊ธฐ๋ณธ์‚ฌ์ด์ฆˆ ๊ธฐ์ค€ ๋Œ€๋น„๋น„์œจ(rem)๋กœ ๋งŒ๋“ค์–ด์ค€๋‹ค!
๊ทธ๋Ÿผ 310px๋กœ ์ค„์–ด๋“ค์—ˆ์„๋•Œ, 260px๋กœ ์ค„์–ด๋“ค์—ˆ์„๋•Œ, ๊ธฐ๋ณธ์‚ฌ์ด์ฆˆ16px๋ณด๋‹ค ๊ธฐ๋ณธ์‚ฌ์ด์ฆˆ๋ฅผ ๋” ์ž‘๊ฒŒ ์„ค์ •ํ•ด์ฃผ๋ฉด ๋Œ€๋น„๋น„์œจ๋กœ ๋“ค์–ด๊ฐ€๊ธฐ๋•Œ๋ฌธ์— ์ผ์ผ์ด ๋‹ค ํฐํŠธ์‚ฌ์ด์ฆˆ๋ฅผ ์•ˆ๋ฐ”๊ฟ”์ค˜๋„ ๋œ๋‹ค!

profile
๋’ค์ฃฝ๋ฐ•์ฃฝ ๋ฒจ๋กœ๊ทธ
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€