/* CSS 파일 */
* {
box-sizing: border-box; /* width = 컨텐츠 + padding + border두께 */
}
body {
/* 상하 여백 0, 좌우 auto는 중앙배치 (width지정해야 적용됨) */
margin: 0 auto;
color: #3d3d3c; /* 전체 글씨 색 */
font-family: 'Spoqa Han Sans Neo', 'sans-serif';
}
/* 중앙배치를 위한 css */
.inner {
width: 100%;
height: 100%;
margin: 0 auto;
padding: 0 2rem;
}
header {
/* background-color: orange;*/
width: 100%;
height: 60px;
top: 0;
left: 0;
position: fixed; /* 위치 고정 */
z-index: 1000;
}
.header-container {
width: 100%;
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.header-logo {
font-weight: bold;
font-size: 1.2rem
}
.header-text {
font-weight: bold;
font-size: 0.9rem;
}
/*section 태그 모두에게 달기 */
section {
/* background-color: aqua; */
width: 100%;
position: relative;
}
/* section에 클래스 속성 main이라고 달아둔것 */
.main {
height: 360px;
background-image: url(images.jpg);
}
.title-container {
padding-top: 100px;
padding-bottom: 100px;
}
.title {
font-size: 2rem;
font-weight: bold;
margin-bottom: 1rem;
}
.message {
font-size: 1.4rem;
font-weight: normal;
}
footer {
background-color: magenta;
}
@media screen and (min-width: 1200px) {
.inner {
max-width: 1200px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<!-- 폰트 라이브러리 경로 -->
<link href='//spoqa.github.io/spoqa-han-sans/css/SpoqaHanSansNeo.css' rel='stylesheet' type='text/css'>
<!-- 외부 스타일 시트에 작성하고 여기 적용시키기 -->
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<header>
<div class="inner">
<div class="header-container">
<div class="header-logo">Test </div>
<div class="header-text">실습용 사이트 예시 </div>
</div>
</div>
</header>
<section class="main">
<div class="inner">
<div class="title-container">
<div class="title">테스트</div>
<div class="message">
안녕하세요 <br />
테스트용 사이트 입니다. <br />
css는 어려워요
</div>
</div>
</div>
</section>
<footer>
© Chance
-----@gmail.com
</footer>
</body>
</html>