๐ฎ BootStrap5 ํด๋์ค ์ด๋ฆ ์ตํ๋ณด๊ธฐ
๋ถํธ์คํธ๋ฉ ํด๋์ค๋ช ์ด์ ๋ฆฌ
์ค๋จ์ ํด๋์ค๋ช
Breakpoint | Class | Dimensions |
X-Small | None | <576px |
Small | sm | ≥576px |
Medium | md | ≥768px |
Large | lg | ≥992px |
Extra large | xl | ≥1200px |
Extra extra large | xxl | ≥1400px |
width / height
// width
.w-25 == width: 25%
-25, 50, 75, 100, auto
// height
.h-50 == height: 50%
// max-width
.mw-40
// max-height
.mh-100
// viewport
min-vw-100
min-vh-100
vw-100
vh-100
ํ ์คํธ ์์
// ํ
์คํธ ์์
.text-primary, white, muted, ...
ํ ์คํธ ์ ๋ ฌ
// ๊ฐ๋ก ์ ๋ ฌ
.text-start, end, center
// ๋ฐ์ํ ์ ๋ ฌ
text-sm-start, ...
ํ ์คํธ ์ค๋ฐ๊ฟ
// ๊ฐ์ ์ค๋ฐ๊ฟ
.text-wrap
// ์ค๋ฒํ๋ก์ฐ (ํ
์คํธ ๋ฐ์ค๋ณด๋ค ๋ด์ฉ๋ฌผ์ด ๋์ณ๋ ๊ทธ๋๋ก ์ถ๋ ฅ)
.text-nowrap
// ์๋ ์ค๋ฐ๊ฟ (ํ
์คํธ ๋ฐ์ค๋ณด๋ค ๋ด์ฉ๋ฌผ์ด ๋์น๋ฉด ์๋ ๊ฐํ)
.text-break
ํ ์คํธ ๋์๋ฌธ์
.text-lowercase, uppercase, capitalize
ํฐํธ ํฌ๊ธฐ
.fs-1 ~ 6
ํฐํธ ์์ฑ
ํ ์คํธ ํ ์ฌ์ด ๊ฐ๊ฒฉ (ํ๊ฐ)
// line-height
.lh-1
.lh-sm
.lh-base
.lh-lg
margin / padding
// ์ผ๋ฐ
{property}{sides}-{size}
.mt-0
.ms-1
.p-3
// ๋ฐ์ํ
{property}{sides}-{breakpoint}-{size}
.me-md-2
{property}
- m - margin
- p - padding
{sides}
- t - mt = margin-top / pt = padding-top
- b - mb = margin-bottom / pb = padding-bottom
- s - ms = margin-left / ps = padding-left (RTL์์๋ ๋ฐ๋)
- e - me = margin-right / ps = padding-right (RTL์์๋ ๋ฐ๋) (์๋ l์ด๋ r๋ก ํ๋ฉด๋์ง ์ s,e๋ก ํ๋...)
- x - *-left and *-right. ์ฆ ๊ฐ๋ก ๋ถ๋ถ
- y - *-top and *-bottom. ์ฆ ์ธ๋ก ๋ถ๋ถ
- blank - ๊ทธ๋ฅ m๋๋ p๋ง ์ฐ๋ฉด 4๋ฐฉํฅ ์ง์
{size}
- 0 - for classes that eliminate the margin or padding by setting it to 0
- 1 - (by default) for classes that set the margin or padding to $spacer * .25
- 2 - (by default) for classes that set the margin or padding to $spacer * .5
- 3 - (by default) for classes that set the margin or padding to $spacer
- 4 - (by default) for classes that set the margin or padding to $spacer * 1.5
- 5 - (by default) for classes that set the margin or padding to $spacer * 3
- auto - margin to auto
์ค์ ์ ๋ ฌ
<div class="mx-auto" style="width: 200px;">
Centered element
</div>
border
// ํ
๋๋ฆฌ ๋ฐฉํฅ
.border-top, end, bottom, start
// ํ
๋๋ฆฌ ์์
.border-primary, white, ...
// ํ
๋๋ฆฌ ๋๊ป
.border-1 ~ 6
// ํ
๋๋ฆฌ ๋ฅ๊ทผ ๋ชจ์๋ฆฌ ํํ
.rounded-top, circle, pill, ...
// ํ
๋๋ฆฌ ๋ฅ๊ทผ ๋ชจ์๋ฆฌ ํฌ๊ธฐ
.rounded-0 ~ 3
background
// ๋ฐฐ๊ฒฝ์
.bg-primary, white, ...
// ๋ฐฐ๊ฒฝ ๊ทธ๋ผ๋ฐ์ด์
.bg-gradient
display
// xsํฌ๊ธฐ ์์๋ง ์ ์ฉ
.d-{value}
.d-inline-block
.d-grid
// ์ค๋จ์ ๋ช
์
.d-{breakpoint}-{value}
.d-lg-block
/* value ๊ฐ */
none
inline
inline-block
block
grid
table
table-cell
table-row
flex
inline-flex
๋ฐ์ํ ์์ ์จ๊ธฐ๊ธฐ
Screen size | Class |
Hidden on all | .d-none |
Hidden only on xs | .d-none .d-sm-block |
Hidden only on sm | .d-sm-none .d-md-block |
Hidden only on md | .d-md-none .d-lg-block |
Hidden only on lg | .d-lg-none .d-xl-block |
Hidden only on xl | .d-xl-none .d-xxl-block |
Hidden only on xxl | .d-xxl-none |
Visible on all | .d-block |
Visible only on xs | .d-block .d-sm-none |
Visible only on sm | .d-none .d-sm-block .d-md-none |
Visible only on md | .d-none .d-md-block .d-lg-none |
Visible only on lg | .d-none .d-lg-block .d-xl-none |
Visible only on xl | .d-none .d-xl-block .d-xxl-none |
Visible only on xxl | .d-none .d-xxl-block |
์ธ์ํ ๋ ํ์ ์ฌ๋ถ
: ์ธ์ํ๋ฉด์์ ์ธ์๋ฒํผ์ด ๋ณด์ด๋ฉด ์๋๋๊น, ๊ทธ๋ฐ๊ฑธ ์จ๊ธธ ๋ ์ฌ์ฉ
.d-print-none, inline, grid, ...
<div class="d-print-none">Screen Only (Hide on print only)</div>
<div class="d-none d-print-block">Print Only (Hide on screen only)</div>
<div class="d-none d-lg-block d-print-block">Hide up to large on screen, but always show on print</div>
float
.float-start, end, none
// ๋ฐ์ํ
.float-sm-start, ...
user-select
: ํ ์คํธ ๋ณต์ฌ ๋๋๊ทธ
.user-select-all, auto, none
pointer events
: ํน์ ์์์์์ ํด๋ฆญ ์ด๋ฒคํธ๋ฅผ ๋์ํ์ง ์๋๋ก ์ ์ด
pe-none, auto
overflow
๋ณด์ด๊ธฐ/์จ๊ธฐ๊ธฐ
.visible
.invisible
๊ทธ๋ฆผ์
position
// position : ์์ฑ
position-static
position-relative
position-absolute
position-fixed>
position-sticky
top, left, right, bottom
top-0, 50, 100
start-0, 50, 100
property :
- top - top position
- start - left position (in LTR)
- bottom - bottom position
- end - right position (in LTR)
position :
- 0 - for 0 edge position
- 50 - for 50% edge position
- 100 - for 100% edge position
translate
top-50 start-50 ์ผ๋ก ํ๋ฉด ์ค์์ผ๋ก ๊ฐ๊ฒ ๊ฐ์ง๋ง, ์ค์์์ ์ด์ง ์ด๊ธ๋๊ฒ ๋ฉ๋๋ค.
translate ํด๋์ค๋ฅผ ์ฐ๋ฉด ์ ํํ ์ค์์ผ๋ก ์ ๋ ฌ ํ ์ ์์ต๋๋ค.
// ์์ ์ค์ ๋ฐฐ์น
.translate-middle
// ์์๋ฅผ ๊ฐ๋ก ๋๋ ์ธ๋ก ๋ฐฉํฅ์ผ๋ก ์ค์ ๋ฐฐ์น
.translate-middle-x
.translate-middle-y
flex
// display: flex;
.d-flex
.d-inline-flex
// ๋ฐ์ํ
.d-sm-inline-flex
.d-xxl-inline-flex
๋ฐฉํฅ
// flex-direction
.flex-row
.flex-row-reverse
.flex-column
.flex-column-reverse
// ๋ฐ์ํ
.flex-sm-row
.flex-md-column
...
์ ์ฒด ์ ๋ ฌ
// ๊ฐ๋ก ์ ๋ ฌ
.justify-content-start
.justify-content-end
.justify-content-center
.justify-content-between
.justify-content-around
.justify-content-evenly
// ์ธ๋ก ์ ๋ ฌ
.align-content-start
.align-content-end
.align-content-center
.align-content-around
.align-content-stretch
// ๋ฐ์ํ
...
์์ดํ ์ ๋ ฌ
// ํ์ค ์ธ๋ก ์ ๋ ฌ
.align-items-start
.align-items-end
.align-items-center
.align-items-baseline
.align-items-stretch
// ์์ดํ
ํ๋ ์ธ๋ก ์ ๋ ฌ
.align-self-start
.align-self-end
.align-self-center
.align-self-baseline
.align-self-stretch
// ๋ฐ์ํ
...
์ฑ์ฐ๊ธฐ
์ผ๋ จ์ ํ์ ์์์ .flex-fill ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ฉด ์ฌ์ฉ ๊ฐ๋ฅํ ๋ชจ๋ ๊ฐ๋ก ๊ณต๊ฐ์ ์ฐจ์งํ๋ฉด์ ์ฝํ ์ธ ์ ๋์ผํ ๋๋น (๋๋ ์ฝํ ์ธ ๊ฐ ํ ๋๋ฆฌ ์์๋ฅผ ์ด๊ณผํ์ง ์๋ ๋๋น)๋ก ๊ฐ์ ์ค์ ํฉ๋๋ค.
.flex-fill
์์ดํ ํฌ๊ธฐ
.flex-{grow|shrink}-0
.flex-{grow|shrink}-1
์๋ ๋ง์ง
Flexbox๋ ํ๋ ์ค ์ ๋ ฌ๊ณผ ์๋์ฌ๋ฐฑ์ ํผํฉํ ๋ ๊ฝค ๋ฉ์ง ์ผ์ ํ ์ ์์ต๋๋ค. ์๋๋ ์๋ ๋ง์ง์ ํตํด ํ๋ ์ค ํญ๋ชฉ์ ์ ์ดํ๋ ์ธ ๊ฐ์ง ์์์ ๋๋ค. ๊ธฐ๋ณธ๊ฐ (์๋ ๋ง์ง ์์), ๋ ํญ๋ชฉ์ ์ค๋ฅธ์ชฝ์ผ๋ก ๋ฐ๊ธฐ ( .me-auto ), ๋ ํญ๋ชฉ์ ์ผ์ชฝ์ผ๋ก ๋ฐ๊ธฐ ( .ms-auto ).
align-items , flex-direction : column , margin-top : auto ๋๋ margin-bottom : auto๋ฅผ ํผํฉํ์ฌ ํ๋์ ํ๋ ์ค ํญ๋ชฉ์ ์ปจํ ์ด๋์ ์๋จ ๋๋ ํ๋จ์ผ๋ก ์์ง ์ด๋ ์ํต๋๋ค.
์ค๋ฐ๊ฟ
// flex-wrap
.flex-wrap
.flex-nowrap
.flex-wrap-reverse
// ๋ฐ์ํ
...
์์
// ์ซ์๋ก ์์ ์ง์
.order-0 ~ 5
// ๊ฐ๊ฐ order : -1, order : 6 ๊ณผ ๊ฐ๋ค
.order-first
.order-last
// ๋ฐ์ํ
...
๋ฏธ๋์ด ๊ฐ์ฒด
# Reference
https://getbootstrap.kr/docs/5.0/getting-started/introduction/