Coding Archive

๋…ธ๋งˆ๋“œ ์ฝ”๋” - ์ฝ”์ฝ”์•„ํ†ก ํด๋ก ์ฝ”๋”ฉ ์—ฐ์Šต(2) ๋ณธ๋ฌธ

๐Ÿ–ฅ๏ธ Clone Coding

๋…ธ๋งˆ๋“œ ์ฝ”๋” - ์ฝ”์ฝ”์•„ํ†ก ํด๋ก ์ฝ”๋”ฉ ์—ฐ์Šต(2)

์ฝ”๋“ฑ์–ด 2022. 4. 19. 00:13

CLONING TIME

 

5. Status Bar CSS

HTML์— CSS๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ์‹ถ์„ ๋•Œ, "link:css"๋ผ ํ•˜๊ณ  ์—”ํ„ฐ๋ฅผ ์น˜๋ฉด ์ž๋™ ์™„์„ฑ๋œ๋‹ค.

ํ›„์— CSS๋ฅผ link ํ•ด์ค€๋‹ค.

<link rel="stylesheet" href="css/styles.css" />

 

font-family๋ฅผ ์ด์šฉํ•˜์—ฌ ์„œ์ฒด๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค.

https://fonts.google.com/ ์—์„œ ์›ํ•˜๋Š” ํฐํŠธ๋ฅผ ๊ฐ€์ ธ๋‹ค ์“ฐ๋ฉด ๋œ๋‹ค. (web font)

link ๋ณด๋‹ค import๋ฅผ ์ถ”์ฒœํ•œ๋‹ค.

import๋Š” style.css ์ œ์ผ ์ƒ๋‹จ์— ์ถ”๊ฐ€ํ•œ๋‹ค.

@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap");

 

body์— font-family๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค. ์ด๋•Œ ์‚ฌ์šฉํ• ์‚ฌ์šฉํ•  ํฐํŠธ๋งŒ ์ถ”๊ฐ€ํ•œ๋‹ค. ๋ชจ๋“  ํฐํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด ์›น์‚ฌ์ดํŠธ ๋ฌด๊ฑฐ์›Œ์ง€๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

body {
  color: #2e363e;
  font-family: "Open Sans", sans-serif;
}

 

 

CSS hack (justify-content ๋Œ€์‹  ์‚ฌ์šฉ ๊ฐ€๋Šฅ)

CSS hack(๊ธฐ์ˆ ) → ๋ ˆ์‹œํ”ผ ๊ฐ™์ด ์–ด๋””๋“  ์“ธ ์ˆ˜ ์žˆ๋‹ค. ์ด์ƒํ•˜์ง€๋งŒ ์ž‘๋™ํ•œ๋‹ค.
 

 1) ์ƒ์œ„ ๋ฐ•์Šค : justify-content: center; →์ค‘์•™์œผ๋กœ ๋ชฐ๋ฆผ
 2) ๋‚ด๋ถ€ ๋ฐ•์Šค ๋ฒ”์œ„ : width: 33%; →์™ผ์ชฝ์œผ๋กœ ๋ชฐ๋ ค์„œ ๋ฒ”์œ„ ๋ฒŒ์–ด์ง, ์™ผ์ชฝ ์œ„์น˜ํ•  ๋ฐ•์Šค๋Š” ์™ผ์ชฝ์— ๋ถ™์–ด์„œ ์ •๋ ฌ๋จ
 3) ์ค‘์•™์— ์œ„์น˜ํ•  ๋ฐ•์Šค : display: flex; justify-content: center; →์ค‘์•™์— ์œ„์น˜ํ•  ๋ฐ•์Šค๋งŒ ์ค‘์•™์— ์œ„์น˜ํ•จ
 4) ์˜ค๋ฅธ์ชฝ์— ์ •๋ ฌํ•  ๋ฐ•์Šค : display: flex; justify-content: flex-end; align-items: center; →์˜ค๋ฅธ์ชฝ์— ๋ถ™์–ด์„œ ์ •๋ ฌ๋จ, ์•„์ด์ฝ˜๋“ค ๊ฐ€์šด๋ฐ๋กœ ์ •๋ ฌ

.status-bar {
  position: fixed;
  top: 0%;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 5px 3px;
  box-sizing: border-box;
}
.status-bar__column {
  width: 33%;
}
.status-bar__column:first-child span {
  margin-right: 5px;
}
.status-bar__column:nth-child(2) {
  display: flex;
  justify-content: center;
}
.status-bar__column:last-child {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

 

์•„์ด์ฝ˜์˜ ํฌ๊ธฐ๋ฅผ ํ‚ค์›Œ์ฃผ๋ ค๋ฉด HTML์—์„œ ์•„์ด์ฝ˜ ์ด๋ฆ„์— 2x or lg ๋“ฑ์„ ๋ถ™์—ฌ์ค€๋‹ค. (fontawesome์—์„œ ์•„์ด์ฝ˜ ๊ฐ€์ ธ์˜ฌ ๋•Œ ์‚ฌ์ด์ฆˆ ์˜ต์…˜๋„ ๋‚˜์™€์žˆ์–ด ์›ํ•˜๋Š” ์‚ฌ์ด์ฆˆ ์ฐธ๊ณ ํ•ด์„œ ํ•˜๋ฉด ๋œ๋‹ค.)

 

 

6. Sign Up Screen part Three

๊ธฐ๋ณธ์ ์œผ๋กœ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์Šคํƒ€์ผ์„ ์—†์• ๋Š” ๋ฐฉ๋ฒ•→reset.css

reset.css๋Š” cssํŒŒ์ผ๋กœ ๋Œ€๋ถ€๋ถ„์˜ ํƒœ๊ทธ์— margin: 0, padding: 0, border: 0๋“ฑ์„ ๊ฐ€์ง„ ํŒŒ์ผ์ด๋‹ค.

 

  1) ๋ฐ‘์˜ ํŒŒ์ผ์„ cssํด๋”์— reset.cssํŒŒ์ผ์„ ๋งŒ๋“ค๊ณ , ๋ถ™์—ฌ ๋„ฃ๋Š”๋‹ค.

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}
body {
  line-height: 1;
}
ol,
ul {
  list-style: none;
}
blockquote,
q {
  quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

input:focus {
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

 

2) reset.cssํŒŒ์ผ์„ styles.cssํŒŒ์ผ์— import๋กœ ์ถ”๊ฐ€ํ•ด์ค€๋‹ค.

@import "reset.css";

 

css๋ฅผ ๋ถ„ํ•  ํ›„ ํ•ฉ์น˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ styles.css๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. (styles.css์— ๊ฐ๊ฐ์˜ cssํŒŒ์ผ๋“ค์„ import)

 

 

7. Log In Form part One

variables.css ์‚ฌ์šฉํ•  ๋•Œ๋Š” cssํด๋”์— variables.cssํŒŒ์ผ์„ ๋งŒ๋“ค๊ณ , style.css ์—์„œ ๊ผญ! import ํ•˜๊ธฐ!

 

๋ณ€์ˆ˜๋ฅผ ์ง€์ •ํ•ด์ค„ ๋•Œ

:root {
  --yellow: #fae100;

 

๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ

#login-form input:focus {
  border-color: var(--yellow);
}

#login-form input[type="submit"] {
  background-color: var(--yellow);
}

 

+) ๊ตฌ๊ธ€ ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ colorzilla ํ™œ์šฉํ•ด์„œ ์ƒ‰์„ ์ถ”์ถœํ•  ์ˆ˜ ์žˆ๋‹ค.

 

 

8. Log In Form part Two

#login-form input {
  border: none;
  padding: 15px 0px;
  font-size: 18px;
  margin-bottom: 25px;
  transition: border-color 0.3s ease-in-out;
}

#login-form input:not([type="submit"]) {
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  transition: border-color 0.3s ease-in-out;
}

#login-form input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

#login-form input:focus {
  border-color: var(--yellow);
}

#login-form input[type="submit"] {
  background-color: var(--yellow);
  cursor: pointer;
  padding: 20px 0px;
  border-radius: 5px;

:not() → ๋ญ”๊ฐ€๊ฐ€ ์ ์šฉ๋˜๋Š” ๊ฑธ ์›ํ•˜์ง€ ์•Š์„ ๋•Œ ์‚ฌ์šฉํ•˜๋ฉฐ, () ์‚ฌ์ด์— ์“ฐ์ธ ๊ฒƒ๋“ค์€ ํŠน์„ฑ ์„ ํƒ์ž(attribute selector)์ด๋‹ค.

not์€ "์ด๊ฒƒ์„ ์ œ์™ธํ•œ ๋‚˜๋จธ์ง€์— ์ ์šฉํ•˜๊ณ  ์‹ถ์–ด์š”"๋ผ๋Š” ๋ง์ด๋ผ์„œ, #login-form input ์—๋„ ๋˜‘๊ฐ™์ด ์“ฐ๋ฉด ์ค‘๋ณต ์ ์šฉ๋˜๊ธฐ ๋•Œ๋ฌธ์— not ์ชฝ์—๋งŒ ์จ์•ผ ํ•œ๋‹ค.

cursor: pointer; ๋กœ ๋ฒ„ํŠผ ์œ„์˜ ์ปค์„œ๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค.

color: inherit;๋Š” ๋ถ€๋ชจ๋กœ๋ถ€ํ„ฐ ์ƒ‰์„ ์ƒ์†๋ฐ›๋Š” ๊ฒƒ์ด๋‹ค.

 

์ถ”๊ฐ€๋กœ css์˜ cascading์— ์˜ํ•˜์—ฌ, #login-form input: not([type="submit"])์— transition์ด ๋“ค์–ด๊ฐ”๊ธฐ ๋•Œ๋ฌธ์—,

#login-form input: focus ๋ณด๋‹ค ์œ„์— ์žˆ์–ด์•ผ focus์— ๋“ค์–ด๊ฐ„ border-color์˜ ๋ณ€ํ™”๊ฐ’์ด ๋‚˜ํƒ€๋‚œ๋‹ค.

ํ•ญ์ƒ cascading์— ์ฃผ์˜!

 

 

9. Recap and Forms

  • bem ๋ฐฉ์‹์ด ์ฝ”๋“œ๊ฐ€ ์ดํ•ดํ•˜๊ธฐ ์‰ฌ์›Œ ์•„๋ฌด๋ž˜๋„ ๋” ์ข‹์€ ๋ฐฉ๋ฒ•์ด๋‹ค.
  • CSS ํŒŒ์ผ์—์„œ ์ฃผ์„์ฒ˜๋ฆฌ๋Š” /* */๋กœ ๊ฐ์‹ธ์ฃผ๋ฉด ๋œ๋‹ค.
  • styles.css ํŒŒ์ผ์—๋Š” font-family (or ๋ชจ๋“  ์Šคํฌ๋ฆฐ์˜ background-color)์™€ ๊ฐ™์ด ๋ชจ๋“  ์Šคํฌ๋ฆฐ์— ์ ์šฉ๋  ์ˆ˜ ์žˆ๋Š” ์Šคํƒ€์ผ์„ ์จ๋†“๋Š”๋‹ค. ์ด๋Š” ํ•˜๋‚˜์˜ ๋ฐฉ์‹์ด๊ณ , ์ž์‹ ๋งŒ์˜ ํŽธํ•œ ๋ฐฉ์‹์„ ํƒํ•˜๋ฉด ๋œ๋‹ค.
  • form์€ ์ค‘์š”ํ•œ 2๊ฐ€์ง€ ์†์„ฑ(attribute)์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค.
    ํ•˜๋‚˜๋Š” action์ด๊ณ , ๋‹ค๋ฅธ ํ•˜๋‚˜๋Š” method์ด๋‹ค.
    1) action
    action์€ ์–ด๋–ค ํŽ˜์ด์ง€๋กœ data๋ฅผ ๋ณด๋‚ผ ๊ฑด์ง€ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.
    action์— ์ ์–ด ๋†“์€ URL์— ํ•ด๋‹นํ•˜๋Š” ํŒŒ์ผ์ด ๋ฐ˜๋“œ์‹œ ์กด์žฌํ•ด์•ผ ํ•œ๋‹ค.
    2) method
    method๋Š” 2๊ฐ€์ง€ ๋ฐฉ์‹ ์ค‘ ํ•˜๋‚˜๋ฅผ ์“ธ ์ˆ˜ ์žˆ๋‹ค. ํ•˜๋‚˜๋Š” POST์ด๊ณ , ๋‹ค๋ฅธ ํ•˜๋‚˜๋Š” GET์ด๋‹ค.
    POST๋Š” ๋ฐฑ์—”๋“œ ์„œ๋ฒ„์— ์ •๋ณด๋ฅผ ์ „์†กํ•˜๋Š” ๋ฐฉ์‹์ด๋ผ ์ด๋ฒˆ ๊ฐ•์˜์—์„œ๋Š” ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋‹ค.
    GET ๋ฐฉ์‹์€ ๋ณด์•ˆ์— ์ทจ์•ฝํ•˜๊ธฐ ๋•Œ๋ฌธ์— username์ด๋ž‘ password๋ฅผ GET ๋ฐฉ์‹์œผ๋กœ ๋ณด๋‚ด์„  ์•ˆ๋œ๋‹ค. URL์— ํฌํ•จ๋˜์–ด๋„ ์ƒ๊ด€์—†๋Š” ์ •๋ณด๋“ค์„ GET ๋ฐฉ์‹์œผ๋กœ ๋ณด๋‚ด๋Š” ๊ฒƒ์ด๋‹ค.
  • Components๋Š” ์ƒํƒœ ํ‘œ์‹œ์ค„๊ณผ ๊ฐ™์ด ๋ฐ˜๋ณต๋˜๋Š” ์š”์†Œ๋ฅผ ์ €์žฅํ•œ๋‹ค.

์•„์ง๊นŒ์ง€ ํฌ๊ฒŒ ์–ด๋ ค์šด ๋ถ€๋ถ„์€ ์—†์—ˆ๋‹ค. ์„ธ๋ถ€์ ์ธ ๋ถ€๋ถ„์„ ๊ณ„์† ๋ฐฐ์šฐ๋‹ค ๋ณด๋‹ˆ ๋‚ด์šฉ์ด ์ ์  ๋งŽ์•„์ ธ ํ—ท๊ฐˆ๋ฆด ๊ฒƒ ๊ฐ™๋‹ค๋Š” ๊ฒŒ ๊ฑฑ์ •์ด์ง€๋งŒ......, ๊ทธ๋ž˜๋„ ํŒŒ์ผ์ด๋‚˜ ์ฝ”๋“œ๋“ค์„ ๋”์šฑ ๊น”๋”ํ•˜๊ฒŒ, ์•Œ์•„๋ณด๊ธฐ ์‰ฝ๊ฒŒ ์ •๋ฆฌํ•  ๋•Œ๋งˆ๋‹ค ์•ฝ๊ฐ„์˜ ํฌ์—ด์ด ๋А๊ปด์ง„๋‹ค.ใ…Žใ…Ž

Comments