728x90
반응형
![](https://blog.kakaocdn.net/dn/b6xAdh/btrKeu2Y7IT/KE9WOIak5hktoyfsTKP4Qk/img.jpg)
사이트 만들기 : 이미지유형03
사이트의 유형은 다양합니다. 메뉴, 배너, 이미지, 슬라이드, 동영상 외에도 많은 유형이 있지만, 그 중에서 이미지 유형에 대해 알아봅시다.
grid를 사용하였으며, grid-gap 셀 사이의 간격, grid-template-rows 행 배치, grid-template-columns 열 배치
Figma
코드를 진행하기에 앞서, 피그마를 이용해서 웹사이트를 디자인합니다.
CSS
/* fonts */
@import url('https://webfontworld.github.io/gmarket/GmarketSans.css');
.gowun {
font-family: GowunBatang;
font-weight: 400;
}
/* reset */
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: #000;
}
img {
width: 100%;
vertical-align: top;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: normal;
}
.ir {
display: block;
overflow: hidden;
font-size: 0;
line-height: 0;
text-indent: -9999px;
}
/* common */
.container {
width: 1160px;
padding: 0 20px;
margin: 0 auto;
min-width: 1160px;
}
.container-fluid {
width: 100%;
padding: 0 100px;
box-sizing: border-box;
}
.section {
padding: 120px 0;
}
.section>h2 {
font-size: 50px;
line-height: 1;
text-align: center;
margin-bottom: 20px;
}
.section>p {
font-size: 22px;
font-weight: 300;
color: #666;
text-align: center;
margin-bottom: 70px;
}
/* imageType */
.image__inner {
display: grid;
grid-template-areas:
"box1 box1 box2 box3"
"box1 box1 box4 box5";
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
grid-gap: 20px;
}
.image {
position: relative;
overflow: hidden;
}
.image__inner .image:nth-child(1) {
grid-area: box1;
background: url(img/img_bg03_01.jpg);
background-size: cover;
}
.image__inner .image:nth-child(2) {
grid-area: box2;
}
.image__inner .image:nth-child(3) {
grid-area: box3;
}
.image__inner .image:nth-child(4) {
grid-area: box4;
}
.image__inner .image:nth-child(5) {
grid-area: box5;
}
.image__box {}
.image__desc {
position: absolute;
left: 0;
bottom: -100%;
width: 100%;
backdrop-filter: blur(6px);
background: rgba(255, 255, 250, 0.3);
padding: 16px;
box-sizing: border-box;
transition: all 0.4s ease;
}
.image:hover .image__desc {
bottom: 0;
}
.image__desc h3 {
font-size: 20px;
}
.image__desc p {
font-size: 16px;
color: #666;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.image__sns {
position: absolute;
right: 10px;
top: 10px;
opacity: 0;
transition: all 0.4s ease;
}
.image__sns a {
width: 36px;
height: 36px;
background: #fff;
border-radius: 50%;
display: block;
margin-bottom: 5px;
background: url(img/img_03_icon.svg) no-repeat;
}
.image__sns a:nth-child(1) {}
.image__sns a:nth-child(2) {
background-position: -50px 0;
}
.image__sns a:nth-child(3) {
background-position: -100px 0;
}
.image__sns a:nth-child(4) {
background-position: -150px 0;
}
.image__sns a:nth-child(5) {
background-position: -200px 0;
}
.image:hover .image__sns {
/* right: 10px; */
opacity: 1;
}
HTML
<section id="imageType03" class="image__wrap gowun section">
<h2>AirPods</h2>
<p>
에어팟의 종류를 알아봅시다.<br>
1세대부터 3세대까지, 프로와 맥스
</p>
<div class="image__inner container-fluid">
<article class="image">
<!-- <figure class="image__box">
<img src="img/image_bg03_01.jpg" alt="AirPods">
</figure> -->
<div class="image__desc">
<h3>AirPods</h3>
<p>AirPods, AirPods Pro, AirPods Max</p>
</div>
<div class="image__sns">
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
</div>
</article>
<article class="image">
<figure class="image__box">
<img src="img/img_bg03_02.jpg" alt="AirPods">
</figure>
<div class="image__desc">
<h3>AirPods</h3>
<p>AirPods, AirPods Pro, AirPods Max</p>
</div>
<div class="image__sns">
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
</div>
</article>
<article class="image">
<figure class="image__box">
<img src="img/img_bg03_03.jpg" alt="AirPods">
</figure>
<div class="image__desc">
<h3>AirPods</h3>
<p>AirPods, AirPods Pro, AirPods Max</p>
</div>
<div class="image__sns">
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
</div>
</article>
<article class="image">
<figure class="image__box">
<img src="img/img_bg03_04.jpg" alt="AirPods">
</figure>
<div class="image__desc">
<h3>AirPods</h3>
<p>AirPods, AirPods Pro, AirPods Max</p>
</div>
<div class="image__sns">
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
</div>
</article>
<article class="image">
<figure class="image__box">
<img src="img/img_bg03_05.jpg" alt="AirPods">
</figure>
<div class="image__desc">
<h3>AirPods</h3>
<p>AirPods, AirPods Pro, AirPods Max</p>
</div>
<div class="image__sns">
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
<a href="https://yhcode.tistory.com" class="link"><span class="ir">페이지이동</span></a>
</div>
</article>
</div>
</section>
728x90
반응형