whatisthis?
Project. ๋ฐ์ํ ํ์ด์ง - (6) Subscription Section ๋ณธ๋ฌธ
(6) Subscription Section
๐ HTML + CSS ์์ฑ
- html ๋งํฌ์ ๊ตฌ์ฑ
์ด๋ฒ์๋ section ๋ง๊ณ aside๋ก ๊ฐ์ธ์ฃผ์.
๋์์ธ์์์ ๋ณด๋ฉด, image๋ถ๋ถ๊ณผ ๋๋จธ์ง title+p+form ๋ถ๋ถ์ผ๋ก ๋๋ ์ง๊ณ ,
col-12(col-md-5)์
col-12(col-md-7)๋ก ๋๋๋ค.
row๋ฅผ ๋๋๋ ๊ธฐ์ค์ ??? - ์ค๋ฐ๊ฟ ํ๋ฉด row ๋ฐ๋ก ์ ๊ธฐ.
์ด๋ฒ์ ๊ฐ์์ค์ ์์ผ๋ฏ๋ก row>col+col
index.html
<aside class="subscription">
<div class="container">
<div class="row">
<div class="col-12 col-md-5">
<div class="subscription-image">
<img src="./assets/img-banner.png" alt="Subscribe us" />
</div>
</div>
<div class="col-12 col-md-7">
<h1 class="subscription-title">Stay with us</h1>
<p class="subscription-desc">
Subscribe to our email newsletter to stay up to date on the latest
updates
</p>
<form action="#" method="POST" class="subscription-form">
<div class="input-group">
<input type="email" placeholder="Enter your email" />
<button type="submit" class="fill-button">Get started</button>
</div>
<p class="form-notice">
Cancel any time. Check out <a href="#">Terms of Use.</a>
</p>
</form>
</div>
</div>
</div>
</aside>
๋์ค์ input์ ๊ฐ๋ก์ ๋ ฌ ํด์ฃผ๊ธฐ ์ํด .input-group div๋ก ๊ฐ์ธ์ค๋ค.
(display: flex ์ธ ์์ !)
๐ป ๋ด๊ฐ ์์ฑํด๋ณธ ์ฝ๋
style.css
/* Subscription */
.subscription {
background-color: #f2f8fa;
text-align: center;
padding: 40px 0;
}
.subscription-image {
padding: 25px;
margin-bottom: 16px;
}
.subscription-image img {
display: block;
width: auto;
height: 190px;
margin: 0 auto;
}
.subscription-title {
margin-bottom: 16px;
font-size: 32px;
line-height: 1;
letter-spacing: -0.05em;
color: #2b292d;
}
.subscription-desc {
margin-bottom: 24px;
}
.subscription .input-group {
margin-bottom: 8px;
}
.subscription .input-group input {
display: block;
width: 100%;
height: 48px;
padding: 0 16px;
border: none;
border-radius: 2px;
margin-bottom: 8px;
color: #7b7b7e;
background-color: #fff;
font-size: 16px;
line-height: 1.5;
letter-spacing: -0.01em;
}
.subscription .input-group .fill-button {
width: 100%;
cursor: pointer;
}
.subscription-form .form-notice {
font-size: 13px;
line-height: 1.5384615;
letter-spacing: 0;
color: #7b7b7e;
}
.subscription-form .form-notice a {
cursor: pointer;
text-decoration: underline;
color: #3040c4;
}
์ด์ desktop ๋ฒ์ ์ ์คํ์ผ์ ์ ์ฉํด๋ณด์. (๋ฏธ๋์ด์ฟผ๋ฆฌ)
input group์ flex๋ฅผ ์ฃผ์.
/* ๐บ ์๋ต - ๋ฏธ๋์ด์ฟผ๋ฆฌ */
/* Subscription */
.subscription {
text-align: left;
padding: 80px 0;
}
.subscription-image {
padding: 8px 0;
}
.subscription-image img {
height: 285px;
margin-left: 0;
}
.subscription-title {
font-size: 40px;
}
.subscription .input-group {
display: flex;
align-items: center;
margin-bottom: 4px;
}
.subscription .input-group input {
height: 56px;
font-size: 18px;
line-height: 1.3333333;
margin-bottom: 0;
margin-right: 8px;
}
.subscription .input-group .fill-button {
flex-shrink: 0;
width: 160px;
}
.subscription-form .form-notice {
font-size: 14px;
line-height: 1.7142857143;
}
๐ก flex-shrink
์ง๋๋ฒ ์ค์ต๋ ๋ฐฐ์ด flex-grow์ ๋ฐ๋๊ฐ๋ .
flex-grow์ ๊ฒฝ์ฐ์
container (width: 600px) | ||
item1 (width: 200px) | item2 (width: 200px) | ๋จ๋๊ณต๊ฐ |
์ด๋ฐ ๊ฒฝ์ฐ์ item2์๊ฒ flex-grow: 1์ ์ฃผ๋ฉด?
container (width: 600px) | ||
item1 (width: 200px) | item2 (width: 400px) |
์ด๋ฐ์์ผ๋ก ๋จ๋๊ณต๊ฐ๊น์ง ์ญ ์๋ผ๊ฒ ๋๋ค.
๋ฐ๋๋ก, flex-shrink๋ ๋ฌด์์ผ๊น?
์ฐ๋ฆฌ๊ฐ flex-wrap ์์ฑ์ default๋ก ๋๋๋ฉด no-wrap์ด๋ค.
no-wrap์ ๋ฌด์จ์ผ์ด ์์ด๋ ํ์ค๋ก ๋ํ๋ด๋ ๊ฒ ์ด๋ฏ๋ก
ํ์์ ์ํด์๋ ์์ ์์ดํ ๋ค์ ํฌ๊ธฐ๋ฅผ ์ค์ฌ๋ฒ๋ฆฐ๋ค.
container (width: 600px) | ||
item1 (width: 200px) | item2 (width: 500px) >> 100px ์ค์ด๋ฌ |
์ด๋, flex-shrink: 0์ ์ค๋ค๋ฉด?
item2์ flex-shrink: 0์ ์ฃผ๋ฉด item2๋ ์ค์ ํ width๋ฅผ ๋ฐ๋์ ์ ์งํ๋ค. (๋๋จธ์ง ์์ดํ ์ด ์ค์ด๋ฌ)
container (width: 600px) | ||
item1 (width:100px) | item2 (width: 500px) >> 100px ์ค์ด๋ฌ |
.subscription .input-group .fill-button {
flex-shrink: 0;
width: 160px;
}
๐ป Design File
๐ปReference Lecture
'PROJECT > WEB' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Project. ๋ฐ์ํ ํ์ด์ง - Review + README.md (0) | 2022.03.03 |
---|---|
Project. ๋ฐ์ํ ํ์ด์ง - (7) Footer Section (0) | 2022.03.02 |
Project. ๋ฐ์ํ ํ์ด์ง - (5) Curriculum Section (0) | 2022.03.02 |
Project. ๋ฐ์ํ ํ์ด์ง - (4) Program Section โก (0) | 2022.03.02 |
Project. ๋ฐ์ํ ํ์ด์ง - (4) Program Section (0) | 2022.03.02 |