...
728x90
반응형
레이아웃 실전 _ 이미지/텍스트 유형
이번에는 텍스트와 이미지가 같이 있는 유형을 한번 만들어보도록 하겠습니다.
이미지/텍스트 유형 디자인하기
만들고자 하는 사이트의 디자인을 구상해봅니다.
구상한 디자인 기반으로 코딩
HTML 작성하기
<!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">
</head>
<body>
<section class="imgtext__wrap section nexon">
<div class="container">
<div class="imgtext__inner">
<article class="imgtext text">
<span class="imgtext__small">park</span>
<h2 class="imgtext__h2">한강을 끼고있는 공원</h2>
<p class="imgtext__pp">한강 주변에는 다양한 공원이 있습니다. 여기에 몇 가지 추천 공원을 알려드리겠습니다.</p>
<ul>
<li>반포 한강공원</li>
<li>여의도 한강공원</li>
<li>이촌 한강공원</li>
<li>뚝섬 한강공원</li>
<li>난지 한강공원</li>
<li>잠원 한강공원</li>
<li>망원 한강공원</li>
<li>잠실 한강공원</li>
<li>광나루 한강공원</li>
<li>강서 한강공원</li>
<li>양화 한강공원</li>
</ul>
</article>
<article class="imgtext image">
<figure class="imgtext__img">
<img src="../asset/img/imgtextType01_01.jpg" alt="공원 이미지1">
</figure>
</article>
<article class="imgtext image">
<figure class="imgtext__img">
<img src="../asset/img/imgtextType01_02.jpg" alt="공원 이미지2">
</figure>
</article>
</div>
</div>
</section>
</body>
</html>
HTML 정리해보기
하나의 컨테이너에 이미지들을 감쌀 수 있는 하나의 박스를 만들고 그 안을 세 개의 <article>로 나누어 주었습니다.
두 번째, 세 번째 <article>은 준비한 이미지를 넣어주고, 첫 번째 <article>에는 <h2>태그를 사용해 주제, <p>태그를 사용해 설명, <li>태그를 사용해 목록을 나타내 주었습니다.
CSS 작성하기
* {
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%;
}
.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;}
.container {
width: 1160px;
margin: 0 auto;
padding: 0 20px;
/* background-color: rgba(0, 0, 0, 0.1); */
}
.nexon {
font-family: 'NexonLv1Gothic';
font-weight: 400;
}
.section {
padding: 120px 0;
}
.center {
text-align: center;
}
.section__small {
font-size: 14px;
border-radius: 50px;
padding: 1px 23px;
background-color: #8179e1;
color: #fff;
text-transform: uppercase;
display: inline-block;
margin-bottom: 20px;
}
.section__h2 {
font-size: 50px;
font-weight: 400;
margin-bottom: 30px;
line-height: 1;
}
.section__desc {
font-size: 22px;
line-height: 25px;
color: #666666;
margin-bottom: 70px;
font-weight: 300;
line-height: 1.5;
}
/* imgtext__type */
.imgtext__inner {
display: flex;
}
.imgtext__inner .imgtext {
width: 373px;
height: 500px;
margin-left: 20px;
}
.imgtext__small {
font-size: 14px;
border-radius: 50px;
padding: 1px 23px;
background-color: #8179e1;
color: #fff;
text-transform: uppercase;
display: inline-block;
margin-bottom: 16px;
}
.imgtext .imgtext__h2 {
font-size: 50px;
margin-bottom: 25px;
}
.imgtext .imgtext__pp {
margin-bottom: 15px;
line-height: 150%;
color: #666666;
}
.imgtext li {
margin-left: 15px;
line-height: 150%;
color: #666666;
}
CSS정리해보기
imgtext__type의 주석 전 까지는 페이지의 기본값을 바꾸어주는 속성들입니다. (앞서 게시한 다른 레이아웃 유형들과 이어집니다.)
<article> 태그를 사용해 이미지가 세로 정렬하기 때문에 상위 요소인 imgtext__inner 에 display : flex; 속성을 부여했습니다.
그 외로는 텍스트 부분의 폰트사이즈, 줄간격 등을 수정해주었습니다.
이상으로 이미지/텍스트 유형의 레이아웃을 만들어 보았습니다 !
728x90
반응형