๊ตฌ๊ธ ํฐํธ ์ ์ฉํ๊ธฐ
๐ต ๊ธ๊ผด์ ์์คํ ์ ๊ธฐ๋ณธ์ผ๋ก ์ค์น๋ ๊ฒ๋ ๋ง์ง๋ง ์ค๋ฌด์์๋ ์์คํ ์ ์๋ ๊ธ๊ผด์ด๋ฉด ์น ํฐํธ ๋ฐฉ์์ผ๋ก ์ถ๊ฐํด์ ์ฌ์ฉํฉ๋๋ค.
Google Fonts
Making the web more beautiful, fast, and open through great typography
fonts.google.com
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&display=swap');
h1 {
font-family: 'Nanum Pen Script', cursive;
}
</style>
</head>
<body>
<h1>๋๋ ํ ์คํฌ๋ฆฝํธ ํฐํธ ์ฌ์ฉ ํ๊ธฐ</h1>
</body>
</html>
1. CSS ํ์ผ ๋ด์์ ํฐํธ ํ์ผ ๊ฒฝ๋ก ์ง์
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
2. font-family ์์ฑ ์ง์
body {
font-family: 'Open Sans', sans-serif;
}
์์ด์ฝ ํฐํธ ์ฌ์ฉํ๊ธฐ
๐ต ์ผ๋ฐ ํ ์คํธ์ฒ๋ผ ์คํ์ผ๋งํ๊ณ ์กฐ์ํ ์ ์๋ ๋ฒกํฐ ์์ด์ฝ์ ์ ๊ณตํ๋ ์น ํฐํธ ์ ๋๋ค.
๐ต ์ด๋ฌํ ์์ด์ฝ ํฐํธ๋ ํ๋/์ถ์๊ฐ ๊ฐ๋ฅํ๋ฉฐ, ์น์ฌ์ดํธ์์ ์์/ํฌ๊ธฐ/๊ทธ๋ฆผ์ ๋ฑ ๋ค์ํ ์คํ์ผ์ ์ ์ฉํ ์ ์์ต๋๋ค.
๐ต ๋ํ์ ์ธ ์์ด์ฝ ํฐํธ๋ก๋ Font Awesome, Google Material Icons, Ionicons ๋ฑ์ด ์์ต๋๋ค.
๊ทธ ์ค Font Awesome ์ ์ฉ ๋ฐฉ๋ฒ์ ์๋ก ๋ค๊ฒ ์ต๋๋ค.
1. Font Awesome CDN ์ ์
https://www.bootstrapcdn.com/fontawesome/
Font Awesome
The recommended CDN for Font Awesome
www.bootstrapcdn.com
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-
free@6.2.1/css/fontawesome.min.css" integrity="sha384-QYIZto+st3yW+o8+5OHfT6S482Zsvz2W
fOzpFSXMF9zqeLcFV0/wlZpMtyFcZALm" crossorigin="anonymous">
</head>
2. ์ํ๋ ์์ด์ฝ์ ์ฐพ์ ํด๋นํ๋ ํด๋์ค ์ด๋ฆ์ ์ฌ์ฉํ์ฌ html์ ์ถ๊ฐ
<i class="fa-brands fa-facebook"></i>
<i class="fa fa-search"></i>
3. ์์ด์ฝ์ ํฌ๊ธฐ, ์์ ์ฌ๋ฐฑ ๋ฑ์ ๋ณ๊ฒฝํ ์ ์์ต๋๋ค.
.fa {
font-size: 2em;
color: blue;
}
๊ธฐํ url
https://cdnjs.com/libraries/font-awesome
font-awesome - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
The iconic SVG, font, and CSS toolkit - Simple. Fast. Reliable. Content delivery at its finest. cdnjs is a free and open-source CDN service trusted by over 12.5% of all websites, serving over 200 billion requests each month, powered by Cloudflare. We make
cdnjs.com
Font Awesome
The internet's icon library + toolkit. Used by millions of designers, devs, & content creators. Open-source. Always free. Always awesome.
fontawesome.com
๊ธฐ๋ณธ๊ฐ ์ด๊ธฐํ
* {
box-sizing: border-box;
}
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reset-css@5.0.1/reset.min.css">
</head>
์ค์ต ์์ (1)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
.container {
width: 304px;
height: 390px;
margin: 0 auto;
border: 1px solid gray;
padding: 28px;
box-sizing: border-box;
}
.google {
margin-left: auto;
margin-right: auto;
border: 1px solid black;
width: 228px;
height: 44px;
line-height: 13px;
}
.google > p {
text-align: left;
font-family: 'Roboto', sans-serif;
font-weight: bold;
}
.google > i {
float: left;
margin-left: 39px;
margin-top: 14px;
margin-right: 7px;
color: red;
}
input {
width: 228px;
height: 44px;
border-style: none;
background-color: #eaeaea;
margin-bottom: 10px;
display: block;
margin-left: auto;
margin-right: auto;
}
.login {
width: 228px;
height: 44px;
background-color: #373f3c;
margin-left: auto;
margin-right: auto;
margin-top: 20px;
margin-bottom: 30px;
padding: 0.2px;
box-sizing: border-box;
}
.login > p {
color: #ffffff;
font-size: 14px;
text-align: center;
font-family: 'Roboto', sans-serif;
}
footer > p {
text-align: center;
font-size: 14px;
color: #2c3432;
font-family: 'Roboto', sans-serif;
}
.content > p {
margin-top: 30px;
margin-bottom: 30px;
text-align: center;
font-family: 'Roboto', sans-serif;
}
</style>
</head>
<body>
<div class="container">
<div class="google">
<i class="fa-brands fa-google"></i>
<p>Log in with google</p>
</div>
<div class="content">
<p>or</p>
</div>
<input type="text" id="username" placeholder="Username">
<input type="text" id="password" placeholder="Password">
<div class="login">
<p>LOGIN</p>
</div>
<footer>
<p>Forgot your password?</p>
</footer>
</div>
</body>
</html>
์ค์ต ์์ (2)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&display=swap');
body {
width: 1000px;
margin: 0 auto;
position: relative;
font-family: 'Nanum Pen Script', cursive;
}
.box1 {
width: 400px;
height: 400px;
padding: 18px;
background-color: #ffff99;
position: relative;
overflow: hidden;
left: 200px;
top: 100px;
transform: rotate(10deg);
}
.box1 > h1 {
text-align: center;
font-size: 44px;
margin-bottom: 20px;
}
.box1 > p {
text-align: center;
font-size: 25px;
margin-bottom: 20px;
}
.box2 {
width: 400px;
height: 400px;
background-color: #ffffcf;
position: absolute;
left: 220px;
top: 450px;
transform: rotate(30deg);
z-index: 1;
}
</style>
</head>
<body>
<div class="box1">
<h1>To. ๋จํธ</h1>
<p>์ฌ๋ณด~ ์ค๋ ๊ธํ๊ฒ ๋จผ์ ์ถ๊ทผํด์ผ ํด์<br>
์ธ์ฌ๋ ๋ชป ํ๊ณ ๋จผ์ ๋๊ฐ์~<br><br>
์์นจ ๊ตถ์ง ๋ง๊ณ ๋์ฅ๊ณ ์ ์๋ ๋ฐ์ฐฌ<br>
์ ์๋ ์ธ์ง์ ๋ฐ์์ ์ฑ๊ฒจ ๋จน๊ณ ๋๊ฐ์~!<br><br>
๊ทธ๋ผ ์ค๋ ํ๋ฃจ๋ ํ๋ด๊ณ ์ด๋ฐ ์ ๋
์ ๋ด์~<br></p>
<p>ํ์ดํ
~!</p>
<div class="box2"></div>
</div>
</body>
</html>
'๐จ Frontend > HTML & CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
CSS โฆ ๊ทธ๋ฆฌ๋(grid) ๋ ์ด์์ (0) | 2023.03.20 |
---|---|
CSS โญ โฅ flex ๋ฐ์ค ๋ ์ด์์ (0) | 2023.03.16 |
CSS โฃ ์ ํ ํจ๊ณผ - (3) ๋ณํ ํจ๊ณผ(transform) (0) | 2023.03.16 |
CSS โฃ ์ ํ ํจ๊ณผ - (2) ์ ๋๋ฉ์ด์ ์์ฑ (2) | 2023.03.15 |
CSS โฃ ์ ํ ํจ๊ณผ - (1) transition, ์ค์ต ์์ (์ผํ๋ชฐ ์ํ ๋ชฉ๋ก) (2) | 2023.03.15 |