Bootstrap์ ์ฒ์ ์ ํ์ ๋ ๋ญ์ผ..์ด๊ฑฐ ๋๋ฌด ์ฝ์์...??? ๋ผ๊ณ ํ๋ค..๐ฆ
- ๋ถ์์์ผ๋ก ์ณ์ ธ ์๋ "Head to the downloads page."๋ฅผ ๋๋ฌ CSS, JS๋ฅผ ๋ค์ด๋ฐ์ HTML ๋ฌธ์์์ ๋งํฌ ์ํค๋ ๋ฐฉ๋ฒ
- ๋ถ์์์ผ๋ก ์ณ์ณ ์๋ ๋๋ฒ์งธ CSS์ JS์ฝ๋๋ฅผ ๋ณต์ฌํด HTML ๋ฌธ์ HEAD์ ๋ฐ๋ก ๋งํฌ๋ฅผ ๋ค๋ ๋ฐฉ๋ฒ
์น ์ฌ์ดํธ๋ ์ ์ฒด 12๋ฑ๋ถ์ผ๋ก ๋๋ ์ ธ ์๋ค.
๋ญ๋ ํฉ์ณ์ 12๊ฐ ๋๋ฉด ํ์ค์ด ๋๊ณ 12๋ฅผ ์ด๊ณผํ๋ฉด ๋ค์์ค๋ก ๋์ด๊ฐ๋ค.<div class="row"> <div class="col-3 box"> box1 </div> <div class="col-3 box"> box2 </div> <div class="col-3 box"> box3 </div> <div class="col-3 box"> box4 </div> </div>
์ ์ฝ๋์ ๊ฒฐ๊ณผ์ด๋ค. ์ ์ฝ๋๋ฅผ ์์ฑํ ๊ฒฐ๊ณผ๋ฅผ ๋ณด๋ฉด ์น์ฌ์ดํธ ์ ์ฒด๋ฅผ ์ฐจ์งํ๋ ๊ฒ์ด ๋ณด์ธ๋ค. col-3 ๊ฒฐ๊ตญ 3 3 3 3 ์ปฌ๋ผ์ด 4๊ฐ์ ์ปฌ๋ผ์ด ์์ด 12๊ฐ ์ปฌ๋ผ์ด ๋ค ์ฑ์์ ธ ์ ์ฒด๋ฅผ ์ฐจ์งํ๋ ๊ฒ์ด๋ค.<div class="row"> <div class="col-3 box"> box1 </div> <div class="col-3 box"> box2 </div> <div class="col-3 box"> box3 </div> <div class="col-5 box"> box4 </div> </div>
์ ์ฝ๋์ ๊ฐ์ด 3 3 3 5 ์ปฌ๋ผ์ด ๋์ด 12 ์ปฌ๋ผ๋ฅผ ์ด๊ณผํด ๋ฒ๋ฆฌ๋ฉด ์ ๊ฒฐ๊ณผ์ ๊ฐ์ด ๋ค์์ค๋ก ๋์ด๊ฐ๋ค.๐งจ๋ฐ์ํ Grid
Gird๋ก๋ ๋ฐ์ํ ๊ทธ๋ฆฌ๋๊ฐ ๊ฐ๋ฅํ๋ค.
์์ ๊ฐ์ด ๊ทธ๋ฆฌ๋ Options์ด ์๋ค. ์ ๊ฒ๋ง ๋ด์๋ ์ดํด๊ฐ ํ๋๋ ์๋ฅผ ๋ณด์.<div class="row"> <div class="col-lg-3 col-md-6 col-sm-12 box"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h5 class="card-title">Card title</h5> <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="card-link">Card link</a> <a href="#" class="card-link">Another link</a> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 box"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h5 class="card-title">Card title</h5> <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="card-link">Card link</a> <a href="#" class="card-link">Another link</a> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 box"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h5 class="card-title">Card title</h5> <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="card-link">Card link</a> <a href="#" class="card-link">Another link</a> </div> </div> </div> <div class="col-lg-3 col-md-6 col-sm-12 box"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h5 class="card-title">Card title</h5> <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="card-link">Card link</a> <a href="#" class="card-link">Another link</a> </div> </div> </div> </div>
๊ฐ ํด๋์ค์ "col-lg-3", "col-md-6", "col-sm-12"๊ฐ ์ง์ ๋์ด ์๋ค.
์ด ๋ป์, lg = large(>=992px), md = medium(>=768px), sm = small(>=540px) ์ด๋ค. ํ๋ฉด์ ์กฐ์ ํ์ ๋ ํด๋น ํฝ์ ๋ก ์กฐ์ ๋๋ฉด
๐งจ ๋ฐ๋ผ์ ๋ค์๊ณผ ๊ฐ๋ค.
- col-lg-3 = 12๊ฐ ์ปฌ๋ผ ์ค 3 3 3 3 ์ปฌ๋ผ ์ฉ ๋ถํ ๋๋ค.
- col-md-6 = 12๊ฐ ์ปฌ๋ผ ์ค 6 6 ์ปฌ๋ผ ์ฉ ๋ถํ ๋๋ค.
- col-sm-12 = 12๊ฐ ์ปฌ๋ผ ์ค 12 ์ปฌ๋ผ์ผ๋ก ๋ถํ ๋๋ค.
โ์ค์
์น์ฌ์ดํธ๋ฅผ ๊ฒฉ์๋ฌด๋ฌ๋ก ๋๋์ด์ ๋ณด๊ณ ์์๋ฅผ ๋ฐฐ์นํ๋ ๊ธฐ์ ์ด๋ค. ํ๋ฉด์ฌ์ด์ฆ์ ๋ฐ๋ผ ๊ฒฉ์๊ตฌ์กฐ๋ฅผ ๋ฐ๊ฟ ์ ์๊ณ , ์ค์ ๋ํ๋ด๋ ์คํ์ผ์ row์ด๊ณ ์ปฌ๋ผ์ ๋ํ๋ด๋ ์คํ์ผ์ col์ด๋ค. ๋ฐ๋ผ์ ํญ์ row ์์ col์ด ๋ค์ด์์ด์ผํ๋ค.
<div class="row"> <div class="col"> </div> <div class="col"> </div> </div>
๋ฐ๋ผ์ row์์ ์๋ ๋ชจ๋ colํฉ์ด 12๋ฅผ ๋์ผ๋ฉด ๋ค์์ค๋ก ๋์ด๊ฐ๋ ๊ฒ์ด๋ค.
๐งจContainer
์นํ์ด์ง๋ค์ ๋ณด๋ฉด ์ฃผ๋ก ๊ฐ์ด๋ฐ๋ก ์ ๋ ฌ๋์ด ์๋ค. ๊ฐ์ด๋ฐ๋ฅผ ์ ๋ ฌ๋์ด ์๋ ์ด์ ๋ ์ฌ์ฉ์๊ธฐ ์นํ์ด์ง๋ฅผ ์ฝ๊ธฐ ํธํ๊ฒ ํ๊ธฐ ์ํด์์ด๋ค.
ํ๋ฉด์ ์์๋ฅผ ๊ฐ์ด๋ฐ๋ก ๋ชจ์์ฃผ๊ณ ์ถ์๋ ์ด๋ค. ํ๋ฉด ์ฌ์ด์ฆ์ ๋ง์ถฐ์ ์ ๋นํ ์ผ์ชฝ ์ค๋ฅธ์ชฝ์ ์ฌ๋ฐฑ์ ์ฃผ๊ณ ๊ฐ์ด๋ฐ ๋ฐฐ์น์ํจ๋ค.
์ฌ์ฉ๋ฒ์ row๋ฅผ container๋ก ๊ฐ์ธ์ฃผ๋ฉด ๋๋ค.<div class="container"> <div class="row"> <div class="col"> </div> <div class="col"> </div> </div>
๐งจComponents
์ปดํฌ๋ํธ๋ ์ฌ์ง๊ณผ ๊ฐ์ด ๋ฏธ๋ฆฌ ๋ง๋ค์ด์ ธ ์๋ ์ปดํฌ๋ํธ๋ค์ ๊ฐ์ ธ๋ค๊ฐ ์ฐ๋ ๋ฐฉ๋ฒ์ด๋ค.
์ฌ์ฉ๋ฐฉ๋ฒ์ ์๋์ ๊ฐ์ด ์ํ๋ ์ฝ๋๋ฅผ ๊ฐ์ ธ๋ค๊ฐ ์ฐ๋ฉด ๋๋ค.
(๋จ, Bootstrap ์ฌ์ฉ๋ฒ๊ณผ ๊ฐ์ด ๋งํฌ๋ฅผ ์์ผ์ค์ผ ๊ฐ๋ฅํ๋ค.)
<button type="button" class="btn btn-primary">Primary</button>
์ด์ ๊ฐ์ด ์ฌ์ฉํ๋ค.
๐Bootstrap์ ์ฌ์ฉํ๊ณ ๋๋์
1. ์ฌ์ฉํ๊ธฐ๊ฐ ๋๋ฌด ์ฝ๋ค.
2. ๋๋ฌด ํธ๋ฆฌํ๋ค.
3. ์๊ฐ์ด ๋จ์ถ๋๋ค.
์ด ๋ฐ์๋ ๋ค์ํ ๊ฒ์ด ๋ง์ง๋ง ์ฌ๊ธฐ๊น์ง๋ง ํ๋ค๋ณด๋ฉด ๋ ์๊ฒ ๋ ๊ฑฐ๋ผ๊ณ ์๊ฐํ๋ค.
์ ๋ฆฌ๊ฐ ์๋์ด์์ด์ ๊ฐ๋ ์ฑ์ด ์ข์์ฉ ๊น๋์ฐ