
Cascading Style Sheets의 약자로, HTML을 꾸며주는 언어
문서를 통째로 한번에 꾸며주는 것이 아니라, HTML 태그를 하나하나 꾸며줌
인라인 (inline)
//태그 안에 style="속성: 값;" 형태로 작성
<!DOCTYPE html>
<html>
<head>
{1월 8일 login.html과 동일}
</head>
<body>
<h2 style="color:blue; text-align:center">Login</h2>
<form>
ID : <input type="text" style="font-size:1rem" placeholder="아이디를 입력하세요"> <br>
PW : <input type="password" placeholder="비밀번호를 입력하세요"> <br>
<input type="button" value="Login" class="login-btn"
style="font-size:1rem; width : 60%; height : 80px"
onclick ="alert('로그인 버튼이 클릭되었습니다.')">
</form>
</body>
</html>

//head 태그 안에 style 태그를 만들어 작성
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login_Screen</title>
<style>
h2 {
color: red;
text-align: center;
}
.login-btn {
font-size: 20px;
width: 100px;
height: 50px;
}
</style>
</head>
<body>
{1월 8일 login.html과 동일}
</body>
</html>

//head 태그 안에 link 태그로 연결 (.css 생성)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login_Screen</title>
<link rel="stylesheet" href="login.css">
</head>
<body>
{1월 8일 login.html과 동일}
</body>
</html>
//login.css
h2 {
color: pink;
text-align: center;
}
.login-btn {
font-size: 20px;
width: 100px;
height: 50px;
}

//태그의 속성 자리에 자바스크립트 코드를 직접 작성
<!DOCTYPE html>
<html>
<head>
{...}
</head>
<body>
<form>
<input type="button" value="Login" class="login-btn"
style="font-size:1rem; width : 60%; height : 80px"
onclick ="alert('로그인 버튼이 클릭되었습니다.')">
</form>
</body>
</html>
let 상자 이름 = 상자에 담을 데이터;(숫자, 문자, element,...)//"</body>" 태그가 끝나기 직전에 "<script> 태그를 만들어 작성
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<h2>Login</h2>
<form>
ID : <input id ="txt_id" type="text" style="font-size:1rem" placeholder="아이디를 입력하세요"> <br>
PW : <input type="password" placeholder="비밀번호를 입력하세요"> <br>
<input type="button" value="Login" class="login-btn" onclick="myfn()">
</form>
<script>
function myfn() {
let user_id = document.getElementById("txt_id").value;
if (user_id == "") {
alert("아이디를 입력하세요");
} else {
alert("안녕하세요" + user_id + "님");
}
}
</script>
</body>
</html>


//head 태그 안에 script 태그로 연결 (.js 생성)
<!DOCTYPE html>
<html>
<head>
{...}
<script src="login.js"></script>
</head>
<body>
<h2>Login</h2>
<form>
{...}
</form>
</body>
</html>
function myfn() {
let user_id = document.getElementById("txt_id").value;
if (user_id == "") {
alert("아이디를 입력하세요");
} else {
alert("안녕하세요 " + user_id + " 님");
}
}
역할 분담
함수와 이벤트
데이터 검증