Cascading Style Sheet
① <div>
등에 class
로 네이밍 (<h1>
<p>
등도 가능)
② <head>
안에 <style>
열어서
③ .mytitle {...}
로 작성
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>로그인 페이지</title>
<link href="https://fonts.googleapis.com/css2?family=Do+Hyeon&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Do Hyeon', sans-serif;
}
.mytitle {
width: 300px;
height: 200px;
color: white;
text-align: center;
background-image: url("https://img1.yna.co.kr/photo/yna/YH/2021/12/28/PYH2021122804370001300_P4.jpg");
background-size: cover;
background-position: center;
border-radius: 10px;
padding-top: 40px;
}
.wrap {
width: 300px;
margin: auto;
}
</style>
</head>
<body>
<div class="wrap">
<div class="mytitle">
<h1>대랑이 전용 내 마음속에 로그인</h1>
<h5>아이디, 비밀번호를 입력해주세요.</h5>
</div>
<p>ID: <input type="text"/></p>
<p>PW: <input type="text"/></p>
<button>로그인하기</button>
</div>
</body>
</html>
CSS 파일 분리
① (style).css
파일을 같은 폴더에 만들고
② <head>
에 불러오기
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>로그인 페이지</title>
<link href="https://fonts.googleapis.com/css2?family=Do+Hyeon&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
</head>