๐ฎ BootStrap5 ์์ด์ฝ ์ฌ์ฉ๋ฒ ์ ๋ฆฌ
BootStrap 5 icons
๋ํ์ ์ธ ํฐํธ ์์ด์ฝ์ผ๋ก๋ ํฐํธ์ด์ธ(FontAwesome), XEIcon, Google Icon Fonts ๋ฑ์ด ์์ต๋๋ค.
๋ถํธ์คํธ๋ฉ ์์ด์ฝ(Bootstrap Icons)์ ํฐํธ ์ด์ธ์ฒ๋ผ ์ฌ์ฉํ๊ธฐ ๋งค์ฐ ์ฝ์ต๋๋ค.
๋๋ถ์ด svg ์์ด์ฝ์ ์ด๋ฏธ์ง๋ก ๋ค์ด๋ก๋ ๋ฐ์ ์๋ ์๊ณ , svg ์ฝ๋๋ฅผ ์ฌ์ฉํ ์๋ ์๋๋ก ๋ค์ํ๊ฒ ํธ์๋ฅผ ์ ๊ณตํฉ๋๋ค.
NPM
> npm i bootstrap-icons
CDN
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.0/font/bootstrap-icons.css">
๋ถํธ์คํธ๋ฉ ์์ด์ฝ ์ ์ฉ๋ฒ
<i> ํ๊ทธ๋ก ์ ์ฉ ๋ฐฉ๋ฒ
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.6.0/font/bootstrap-icons.css" />
</head>
<body>
<i class="bi-check fs-5"></i>
<i class="bi-arrow-right-circle fs-5"></i>
</body>
ํ๋์ฉ ์์๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
<i class="bi-check fs-5"></i>
์์ bi- ๋ค์์ ์์ด์ฝ ๋ช
์ ์ ์ด์ฃผ์๋ฉด ๊ทธ ์์ด์ฝ์ผ๋ก ์ ์ฉ๋๊ฒ ๋ฉ๋๋ค.
๋ง์ผ ์ฌ๊ณผ ์์ด์ฝ์ ์ ์ฉํ๊ณ ์ถ๋ค๋ฉด bi-apple ์ด๋ผ๊ณ ์จ์ฃผ๋ฉด ์ ์ฉ ๋ฉ๋๋ค.
fs-5 ๋ font-size 5๋ฐฐ์ ํฌ๊ธฐ ์ ์ฝ์์
๋๋ค.
๋ง์ผ ์ข๋ ์์ธํ๊ฒ ์์ด์ฝ์ ์์ฑ์ ์กฐ์ ํ๊ณ ์ถ๋ค๋ฉด, css์์ ์์ด์ฝ ํด๋์ค๋ช ์ ์ ์ํด ์ฌ์ฉํ ์ ์์ต๋๋ค.
.bi-check{
font-size: 22px;
line-height: 22px;
color:crimson;
}
<svg> ํ๊ทธ๋ก ์ ์ฉ ๋ฐฉ๋ฒ
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.6.0/font/bootstrap-icons.css" />
</head>
<body>
<!-- ๊ทธ๋๋ก body ํ๊ทธ์์ ๋ถ์ฌ๋ฃ์ผ๋ฉด ๋ฉ๋๋ค. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-watch" viewBox="0 0 16 16">
<path d="M8.5 5a.5.5 0 0 0-1 0v2.5H6a.5.5 0 0 0 0 1h2a.5.5 0 0 0 .5-.5V5z"/>
<path d="M5.667 16C4.747 16 4 15.254 4 14.333v-1.86A5.985 5.985 0 0 1 2 8c0-1.777.772-3.374 2-4.472V1.667C4 .747 4.746 0 5.667 0h4.666C11.253 0 12 .746 12 1.667v1.86a5.99 5.99 0 0 1 1.918 3.48.502.502 0 0 1 .582.493v1a.5.5 0 0 1-.582.493A5.99 5.99 0 0 1 12 12.473v1.86c0 .92-.746 1.667-1.667 1.667H5.667zM13 8A5 5 0 1 0 3 8a5 5 0 0 0 10 0z"/>
</svg>
</body>
[๋ถํธ์คํธ๋ฉ ์์ด์ฝ svg ์ฝ๋์์ ํฌ๊ธฐ์ ์์ ๋ณ๊ฒฝํ๊ธฐ]
svg ์ฝ๋๋ฅผ ๋ฃ์ ๊ฒฝ์ฐ ์ฝ๋ ๋ด๋ถ์ ์์ฑ์ ๋ณ๊ฒฝํด์ ํฌ๊ธฐ์ ์์์ ๋ณ๊ฒฝํ ์ ์์ต๋๋ค.
CSS ์ ํ์๋ก ๋์์ธ ํ ์ ์์ต๋๋ค.
svg.className {
width: 100px;
height: 100px;
color: limegreen;
}
๋ณด๋์ค) ๋ถํธ์คํธ๋ฉ ์์ด์ฝ ํด๋ฆญ ์ด๋ฒคํธ ์์
See the Pen ๋ถํธ์คํธ๋ฉ ์์ด์ฝ ํด๋ฆญ์ด๋ฒคํธ ์์ by barzz12 (@inpaSkyrim) on CodePen.
# ์ฐธ๊ณ ์๋ฃ
https://www.inflearn.com/blogs/1446