[TIL] CSS Break down (button, @screen)

jay__ssยท2021๋…„ 11์›” 10์ผ
1
post-thumbnail

1. So many Buttons,,,๐Ÿคฃ

๋งˆ์šฐ์Šค ์˜ค๋ฒ„ ์‹œ, ์–˜๊ฐ€ ๋ฒ„ํŠผ์ด๋ผ๊ณ  ํ™•์‹คํžˆ ๋Š๊ปด์ง€๋Š” ๋ฒ„ํŠผ๋“ค์„ ์‹ค์Šตํ•ด๋ณธ๋‹ค.

๋ชฐ๋ž๊ณ  ์‹ ๊ธฐํ•œ ๋ฒ„ํŠผ๋“ค์ •๋„๋งŒ ์„ค๋ช…ํ•ด๋ณด๊ณ , ์ง์ ‘ ์•„๋ž˜์—์„œ ๋ˆˆ์œผ๋กœ ํ™•์ธ!!!

https://ssssssjay.github.io/Front-end-school/button-challenge.html

.c1:hover {
    transform: translateX(100px);
    transition-timing-function: ease; }
.c2:hover {
    transform: translateX(100px);
    transition-timing-function: linear; }
.c3:hover {
    background: darkgreen; }
.c4:hover {
    background: darkgreen;
    color: salmon; }
.c5:hover {
    transform: scale(1.4); }

.c5 : ์šฐ์„  sclae, ๋จธ๋ฆฟ์†์—์„œ ์ •๋ฆฌ๊ฐ€ ์ž˜ ์•ˆ๋˜์—ˆ๋˜ ๊ฒƒ ๊ฐ™๋‹ค.
์Šค์ผ€์ผ์€ ํ™•๋Œ€, ์ถ•์†Œ์ด๋‹ค! ์ฆ‰ ๋„ˆ๋น„๋†’์ด๋ฟ ์•„๋‹ˆ๋ผ, ๊ธ€์”จํฌ๊ธฐ๊นŒ์ง€ ํ™•๋Œ€๋˜์–ด ๋ณด์ธ๋‹ค!
(ํฌ๊ธฐ๊ฐ€ ์‹ค์ œ๋กœ ์ปค์ง„๋‹ค๋ผ๊ธฐ ๋ณด๋‹ค๋Š” '๋‹๋ณด๊ธฐ๋กœ ๋ณธ๋‹ค'๋กœ ์ดํ•ดํ•œ๋‹ค)

.c6:hover {
    width: 1000px;
    height: 270px;
}
.c7:hover {
    letter-spacing: 20px;
    width: 370px;
}
.c8:hover {
    /* overflow hidden ์žˆ๋Š”๊ฑฐ ๋ช…์‹ฌ!!! */
    line-height: 400px;
}

.c8 : ์ค„ ๊ฐ„๊ฒฉ์ด ๋„“์–ด์ง„๋‹ค. ์ฆ‰ ๊ธ€์”จ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์œ„์•„๋ž˜์— ๊ณต๊ฐ„์ด ์ƒ๊ธด๋‹ค. ์ด ๋•Œ, ๊ธ€์”จ๋Š” ๋ถ€๋ชจ๋ฐ–์œผ๋กœ ๋‚˜๊ฐ€ ๋ฒ„๋ฆดํ…Œ๊ณ , ๋ถ€๋ชจ์— overflow: hidden;์„ ์ฃผ์–ด ๋„˜์ณ๋‚˜๋Š” ์• ๋Š” ๋ณด์—ฌ์ฃผ์ง€ ์•Š๋Š”๋‹ค!!!

.c9:hover {
    opacity: 0.3;
}
.c10:hover {
    border-color:deepskyblue;
    border-width: 20px;
}
.c11:hover {
    transform: rotate(20deg);
}
.c12:hover {
    transform-origin: top;
    transform: rotate(20deg);

}
.c13:hover {
    transform-origin: right;
    transform: rotate(20deg);

}
.c14:hover {
    transform-origin: left;
    transform: rotate(20deg);
}
.c15:hover {
    transform-origin: bottom;
    transform: rotate(20deg);
}

์—ฌ๊ธฐ์„œ๋ถ€ํ„ฐ๋Š” pseudo element๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋งŒ๋“œ๋Š” ์‹ค๋ฌด๋Š๋‚Œ์˜ ๋ฒ„ํŠผ์ด๋‹ค.

.c16::before {
    content: '';
    position: absolute;
    background-color: seagreen;
    /* ์ „์ฒด๋ฅผ ๋‹ค ์ฐจ์ง€ํ•˜๊ฒŒ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•!!!! */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    /* ์ด ๊ฐ’์ด ํด์ˆ˜๋ก ๋ฉ€๋ฆฌ์„œ ๋‚ ์•„์˜ค๊ธฐ์— ์˜ค๋ž˜๊ฑธ๋ฆฐ๋‹ค */
    transform: translateX(550px);
    transition: all 1s;
}
.c16:hover::before {
    transform: translateX(0px);  
    /* opacity: .4; */
}

์›๋ž˜์˜ ์‹œ๋‚˜๋ฆฌ์˜ค๋Š” ๋ฐฐ๊ฒฝ์ด ๋ฐ€๊ณ  ๋“ค์–ด์˜ค๋ฉด์„œ ๊ธ€์ž๋Š” ๋ณด์—ฌ์•ผ ํ•˜๋Š”๋ฐ, ๋ฐฐ๊ฒฝ์ด ๋ฎ์–ด๋ฒ„๋ฆฐ๋‹ค๐Ÿฅต
z-index๋ฅผ ํ™œ์šฉํ•˜์—ฌ ํ•ด๊ฒฐ์ด ๊ฐ€๋Šฅํ•˜๋‹ค!!!(ํˆฌ๋ช…๋„๋ฅผ ์ฃผ๋ฉด ๊ธ€์ž๋„ ํˆฌ๋ช…ํ•ด์ ธ,,,)

.c16 {z-index: 1;) .c16::before {z-index: -1;}

์ด๋ ‡๊ฒŒ ๊ธ€์ž๊ฐ€ ์žˆ๋Š”๋…€์„์€ ์•ž์œผ๋กœ ์˜ค๊ฒŒํ•˜๊ณ  ๋ฐฐ๊ฒฝ๋งŒ์„ ๋‹ด๋‹นํ•˜๋Š” ๋…€์„์€ ๋’ค๋กœ ๋ณด๋‚ธ๋‹ค!
ํ•œ ๋…€์„๋งŒ ์ฒ˜๋ฆฌํ•ด์ฃผ๋ฉด ์•ˆ๋œ๋‹ค!!!!!

.c17::before {
    content: '';
    position: absolute;
    background-color: white;
    width: 100%;
    height: 10px;
    left: 0;
    bottom: 0;
    transform: translateX(-550px);
    transition: all 1s;
}

.c17:hover::before {
    transform: translateX(0);
}

.c17::after {
    content: '';
    position: absolute;
    background-color: white;
    width: 100%;
    height: 10px;
    left: 0;
    bottom: 0;
    transform: translateX(550px);
    transition: all 1s;
}
.c17:hover::after {
    transform: translateX(0);
}

.c18::before {
    content: '';
    position: absolute;
    background-color: white;
    width: 100%;
    height: 10px;
    left: 0;
    bottom: 0;
    transform: translateX(-550px);
    transition: all 1s;
}

.c18:hover::before {
    transform: translateX(0);
}

.c18::after {
    content: '';
    position: absolute;
    background-color: white;
    width: 100%;
    height: 10px;
    right: 0;
    top: 0;
    transform: translateX(550px);
    transition: all 1s;
}

.c18:hover::after {
    transform: translateX(0);
}

17๋ฒˆ๊ณผ 18๋ฒˆ์˜ ๊ฐ€์žฅ ํฐ ์ฐจ์ด์ ์€, ::after์˜ ํฌ์ง€์…˜์ด๋‹ค!!!
์–‘ ์ชฝ์œผ๋กœ ๊ฐ€์ƒ ํด๋ž˜์Šค๋ฅผ ๋ณด๋‚ด๋†“์€๊ฒƒ์€ ์ข‹์ง€๋งŒ, ๊ทธ ์ถœ๋ฐœ์„ ์ด ๊ฐ™์€๊ฒŒ ๋ฌธ์ œ๋‹ค.
ํ•œ ๋†ˆ์€ ์•„๋ž˜์—์„œ ์™ผ์ชฝ์œผ๋กœ ์ถœ๋ฐœ์‹œํ‚ค๊ณ , ๋‹ค๋ฅธ ๋†ˆ์€ ์œ„์—์„œ ์˜ค๋ฅด์ชฝ์œผ๋กœ ์ถœ๋ฐœ์‹œ์ผœ๋†“๋Š”๋‹ค.

๋ถ€๋ชจ์˜ relative๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ž์‹๋“ค์˜ ์œ„์น˜๋ฅผ ์žก์•„์ค„ ์ˆ˜ ์žˆ๋‹ค. absolute!

.c19::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: teal;
    transition: all 0.8s;
    transform: rotateX(90deg);
    z-index: -1;
}

.c19:hover::before {
    transform: rotateX(0);
}
.c19::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: teal;
    transition: all 0.8s;
    transform: rotateY(90deg);
    z-index: -1;
}
.c19:hover::after {
    transform: rotateY(0);
}
.c19:hover {
    /* z-index: 1; */
}
.c19 {
    z-index: 1;
}

.c20::after {
    content: '1';
}
.c20::after::after {
    content: '2';
}
.c20::after::after::after {
    content: '3';
}

.c21::before {
    position: absolute;
    content: '์งœ-์ž์ž”!';
    color: white;
    background: coral;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(-100%);
    transition: all .8s;
}
.c21:hover::before {
    transform: translateY(0);
}

.c19 : ์š” ๋…€์„์€ ๊ฐ€์ƒ ์š”์†Œ๋ฅผ ์›๋ž˜ 90๋„๋กœ ์„ธ์›Œ๋†“๊ณ  ๋งˆ์šฐ์Šค ์˜ค๋ฒ„ ์‹œ, ํšŒ์ „์‹œ์ผœ์ฃผ์–ด์„œ ํšจ๊ณผ๋ฅผ ์ฃผ๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค!!

2. media query - ๋ฐ˜์‘ํ˜• ์›น๐Ÿ˜€

์›น์„ ๋งŒ๋‚  ์ˆ˜ ์žˆ๋Š” ํ™˜๊ฒฝ์€ ํฌ๊ฒŒ ์„ธ ๊ฐ€์ง€์ •๋„๊ฐ€ ์žˆ๋‹ค.

PC - Tablet - Mobile

๊ฐ ํ™˜๊ฒฝ์— ๋งž๊ฒŒ ๋ ˆ์ด์•„์›ƒ์„ ์งœ์•ผํ•œ๋‹ค.
์Šค๋งˆํŠธํฐ์—์„œ ์ƒํ•˜์ขŒ์šฐ๋กœ ์Šคํฌ๋กคํ•˜๋ฉด์„œ ์“ฐ์ง€๋Š” ์•Š์„ํ…Œ๋‹ˆ!!

์ด ๋•Œ, ์“ธ ์ˆ˜ ์žˆ๋Š”๊ฒŒ @media (์•ณ ๋ฏธ๋””์–ด)์ด๋‹ค.

body{background:black;}

@media screen and (min-width:481px) and (max-width:1280px){
  body{background:red;}
}

@media screen and (max-width:480px){ 
  body{background:green;}
}

์•„๋ž˜์— ๋ฐ˜์‘ํ˜• ์›น ํฌ์ŠคํŒ…์„ ์ž‘์„ฑํ•˜์˜€๋‹ค.

https://velog.io/@jay__ss/Project-%EB%B0%98%EC%9D%91%ED%98%95-%EC%9B%B9

New!!!

  • ์ž์‹์š”์†Œ๊ฐ€ ๋ถ€๋ชจ์š”์†Œ๋งŒํผ์˜ ํฌ๊ธฐ๋ฅผ ๊ฐ€์ง€๊ฒŒ ํ•˜๋Š” ๋ฐฉ๋ฒ•
position: absolute;
top: 0; left: 0; right: 0; bottom:0;
/* or */
top: 0; left: 0; width: 100% height: 100%
  • class="card item" = .card.item ์žŠ์ง€๋ง์ž ์„ ํƒ์ž!!!

๋์œผ๋กœ

์˜ค๋Š˜์€ ๋ฒ ๋ฅผ๋ฆฐ์— ๊ณ„์‹œ๋Š” ์ด์ˆ˜์ง„ ๊ฐœ๋ฐœ์ž๋‹˜์˜ ํŠน๊ฐ•์„ ๋“ค์—ˆ๋‹ค. ์Œ์•…์„ ๊ณต๋ถ€ํ•œ ๋น„์ „๊ณต์ž์—์„œ PM์„ ๊ฑฐ์ณ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋˜์‹  ์–ด๋งˆ๋ฌด์‹œํ•œ ๋ถ„์ด์…จ๋‹ค๐Ÿ˜ ๋กœ๋“œ๋งต์„ ๋ณด๊ณ  '์•„ ์ด๋Ÿฐ๊ฒŒ ์žˆ๊ตฌ๋‚˜'์˜ ์ ‘๊ทผ๋ฒ•์ด ์•„๋‹Œ ์ฃผ๋‹ˆ์–ด๊ฐ€ ๋˜๊ธฐ์œ„ํ•ด ์†Œ๋ชฉ์ , ๋Œ€๋ชฉ์ ์„ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ๋ ค์ฃผ์…จ๋‹ค. ๋‹ค์Œ ๋‹จ๊ณ„๋กœ ๊ฐ€๊ธฐ ์œ„ํ•ด ๋‚ด๊ฐ€ ํ•  ๋‹น์žฅ์˜ ์†Œ๋ชฉ์ ์„ ์žก์•„๋ณด์•˜๋‹ค.

Layout Practice - ๋ˆˆ ๊ฐ๊ณ  ์งค ๋•Œ๊นŒ์ง€

profile
๐Ÿ˜‚๊ทธ๋ƒฅ ์ง์ง„ํ•˜๋Š” (์˜ˆ๋น„)๊ฐœ๋ฐœ์ž

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

comment-user-thumbnail
2021๋…„ 11์›” 11์ผ

์ด์ˆ˜์ง„๋‹˜ ํŠน๊ฐ•์€ ์ •๋ง ๋ผˆ์™€ ์‚ด์ด ๋˜์—ˆ๋˜๊ฑฐ ๊ฐ™์•„์š” ..!

๋‹ต๊ธ€ ๋‹ฌ๊ธฐ
comment-user-thumbnail
2021๋…„ 11์›” 11์ผ

๋ ˆ์ด์•„์›ƒ ๋ˆˆ๊ฐ๊ณ  ์งค ๋•Œ๊นŒ์ง€!! ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค!!

๋‹ต๊ธ€ ๋‹ฌ๊ธฐ