728x90
반응형
배너 유형 페이지 만들어보기!!
이미지 유형 : https://dongjin6539.tistory.com/28
카드 유형 : https://dongjin6539.tistory.com/31
텍스트 유형 : https://dongjin6539.tistory.com/35
이미지/텍스트 유형 : https://dongjin6539.tistory.com/39
슬라이드 유형 : https://dongjin6539.tistory.com/40
헤더 유형 : https://dongjin6539.tistory.com/44
푸터 유형 : https://dongjin6539.tistory.com/49
지난 번에 이어 또다른 페이지를 만들어보았습니다.
지난 번과 같은 방식으로 시작해보겠습니다.
코드 블럭
<!DOCTYPE html>
<html lang="ko">
<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>배너 유형01</title>
<link href="https://webfontworld.github.io/NexonLv1Gothic/NexonLv1Gothic.css" rel="stylesheet">
<style>
/* reset */
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: #000;
}
h1,h2,h3,h4,h5,h6 {
font-weight: normal;
}
img {
vertical-align: top;
width: 100%;
}
li {
list-style: none;
}
.blind{
position: absolute;
clip: rect(0 0 0 0);
width: 1px;
height: 1px;
margin: -1px;
overflow: hidden;
}
.mt10 {margin-top: 10px !important;}
.mt20 {margin-top: 20px !important;}
.mt30 {margin-top: 30px !important;}
.mt40 {margin-top: 40px !important;}
.mt50 {margin-top: 50px !important;}
.mt60 {margin-top: 60px !important;}
.mt70 {margin-top: 70px !important;}
.mb10 {margin-bottom: 10px !important;}
.mb20 {margin-bottom: 20px !important;}
.mb30 {margin-bottom: 30px !important;}
.mb40 {margin-bottom: 40px !important;}
.mb50 {margin-bottom: 50px !important;}
.mb60 {margin-bottom: 60px !important;}
.mb70 {margin-bottom: 70px !important;}
/* common */
.container {
width: 1160px;
margin: 0 auto;
padding: 0 20px;
/* background-color: #cacaca; */
}
.nexon {
font-family: 'NexonLv1Gothic';
font-weight: 400;
}
.section {
padding: 120px 0;
}
.section.center {
text-align: center;
}
.section__small {
font-size: 14px;
border-radius: 50px;
background-color: #FF0000;
color: #fff;
padding: 1px 23px;
text-transform: uppercase;
margin-bottom: 20px;
display: inline-block;
line-height: 1.5;
}
.section__h2 {
font-size: 50px;
font-weight: 400;
margin-bottom: 30px;
line-height: 1;
}
.section__desc {
font-size: 22px;
color: #666;
margin-bottom: 70px;
font-weight: 300;
line-height: 1.5;
}
/* banner__wrap */
.banner__wrap {
background-image: url(../asset/img/bannerType01_01.jpg);
height: 500px;
background-size: cover;
box-sizing: border-box;
background-repeat: no-repeat;
background-position: center center;
}
.banner__inner {
text-align: center;
color: #fff;
}
.banner__inner h3 {
font-size: 50px;
margin-bottom: 50px;
}
.banner__inner p {
font-size: 16px;
line-height: 1.6;
margin-bottom: 100px;
}
.banner__inner a {
color: #fff;
}
</style>
</head>
<body>
<section class="banner__wrap section nexon">
<h2 class="blind">배너</h2>
<div class="contanier">
<div class="banner__inner">
<h3>운동의 시작</h3>
<p>운동을 시작하기에 앞서 자신의 마음먹기가 달렸습니다.<br>목표를 설정하고 시작하는 것이 좋습니다.</p>
<a href="#">https://dongjin6539.tistory.com/</a>
</div>
</div>
</section>
</body>
</html>
방법
- 지난번에 했던 유형 페이지 의 글꼴과 style 태그의 /* reset */, /* commom */ 에 해당하는 부분은 모든 페이지의 공용으로 사용하기 때문에 그대로 가져왔습니다. 다만, 추가로 바꿔야 할게 있으면 모든 페이지에 추가를 해줘야 합니다.
- 이번에는 가운데 정렬을 사용하지 않기 때문에 body 태그에 section 태그를 주고 class 명을 "banner__wrap section nexon"을 입력해줍니다.
- 자식으로 h2 태그로 일단 영역을 표시해주고 class 명을 "blind"로 입력하고 스타일을 계속 사용할 수도 있기 때문에 style 태그의 /* reset */ 부분에 숨기기 위한 스타일 속성을 입력해줍니다.
- 배너 안에 글자의 구역을 만들기 위해 지난번에 사용했던 스타일을 그대로 가져오기 위해 class 명을 "container"을 div 태그를 사용해서 입력해줍니다.
- class "container" 자식으로 배너 안에 텍스트를 입력하기 위해 class "banner__inner"를 입력하고 그 안에 자식으로 h3 태그, p 태그, a 링크 태그를 사용해서 텍스트를 입력해줍니다.
- style 태그로 이동해서 "banner__wrap", "banner__inner", "banner__inner h3", "banner__inner p", "banner__inner a" class에 각각 알맞는 스타일 속성을 입력해줍니다.
- "banner__wrap"에는 background-image 속성을 사용해서 이미지를 넣어주고 background-size: cover;, box-sizing: border-box;, background-repeat: no-repeat;, background-position: center center; 스타일 속성을 입력해서 이미지에 대한 스타일을 입력해줍니다.
- 그러면 원하는 웹 페이지가 만들어집니다.
참고
- 스타일 속성(https://developer.mozilla.org)
속성 | 설명 |
background-image: url( ); | 요소의 배경 이미지를 한 개나 여러 개 지정합니다. |
background-size | 배경 이미지 크기를 설정합니다. |
box-sizing | 요소의 전체 너비와 높이를 계산하는 방법을 설정합니다. |
background-repeat | 배경 이미지가 반복되는 방식을 설정합니다. 배경 이미지는 가로 및 세로 축을 따라 반복되거나 전혀 반복되지 않을 수 있습니다. |
background-position | 배경 이미지의 초기 위치를 설정합니다. |
- 이해가 안됐을 경우 이용해 보세요!!
728x90
반응형