CSS는 HTML로 만들어진 콘텐츠에 레이아웃과 디자인요소를 정의하는 기술이다.
HTML만으로 설계
CSS 추가 설계
footer{
text-align: center;
background-color: #1e1e1e;
}
------
footer : 선택자
text-align : / background-color : 선언부
<html>
<head>
<style>
body {
background-color: red;
}
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head>
<body>
...
</body>
</html>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>김멋사의 이력서</title>
<link rel="stylesheet" href="codelion.css"> // css 문서를 호출하여 디자인 사용
</head>
<body>
<h1>김멋사</h1>
<p>HTML/CSS 개발자</p>
<footer>copyright CODE LION. All rights reserved.</footer>
</body>
</html>
footer {
text-align: center;
background-color: #1e1e1e;
color: #919191;
font-size: 12px;
}
<h1 style="color:blue; margin-left:30px;">This is a heading</h1>
<html>
<head>
<meta charset="UTF-8">
<title>김멋사의 이력서</title>
</head>
<body>
<div class="mainbox">
<h1 style="color:blue;">김멋사</h1>
<p style="color:green; margin-left:30px">HTML/CSS 개발자</p>
</div>
<footer>copyright CODE LION. All rights reserved.</footer>
</body>
</html>
브라우저 디자인 정의 -> 외부 스타일시트 -> 내부 스타일시트 -> 인라인 스타일시트
(1) 글자 설정
p {
font-size : 15px; // 글자 크기 설정
background-color: black; // 배경색 설정
color: white; // 글자색 설정
}
(2) 구역 박스 설정
.mainbox {
border: 1px solid #ebebeb; // 테두리 1, 솔리드 형식, 회색
width: 610px; // 박스 크기 설정
text-align: center; // 박스 내 글자 정렬
margin-left: auto; // 박스 가운데 정렬
margin-right: auto; // 왼쪽과 오른쪽 정렬
}
(3) 박스 쪼개기
.mainbox{
width:610px; // 박스 크기
margin-right: auto; // 박스 가운데 정렬
margin-left: auto;
border: 1px solid #ebebeb; // 박스 테두리 설정
text-align: center; // content 정렬
padding: 10px; // content와 border사이 10 여백
margin: 20px; // border와 웹페이지 사이 20 여백
}
※ 참고자료 : https://dinfree.com/lecture/frontend/122_css_1.html#m4