728x90
반응형
사이트 만들기 : 카드 유형03
이번 카드 유형은 큰 이미지가 3개이다. 먼저 생각해야할건 상자?를 3개로 잡아야한다. 전체 배경이 들어갔다.
HTML 유형
<section id="cardType03" class="card__wrap score section">
<h2 class="blind">주황색 과일</h2>
<div class="card__inner container">
<article class="card">
<figure class="card__header">
<img src="img/card_bg03_1.jpg" alt="Architects">
<figcaption>orange</figcaption>
</figure>
<div class="card__contents">
<h3>오렌지(orange) 의 대하여 알아보자.</h3>
<p>오렌지는 비타민 c가 매우 풍부한 과일의 하나로, 일반적 으로 당귤 나무의 열매인 당귤을 부르는 말이다. 대표적인 귤 열매로 기름기를 함유한 가죽질 껍질과
즙이 많은 과육으로 이루어져 있다.</p>
</div>
<div class="card__footer">
<h4>오렌지 박사<em>9 Resources</em></h4>
<span><img src="img/card_bg03_1.png" alt="프로필"></span>
</div>
</article>
<article class="card">
<figure class="card__header">
<img src="img/card_bg03_2.jpg" alt="Architects">
<figcaption> Hallabong</figcaption>
</figure>
<div class="card__contents">
<h3>한라봉(Hallabong) 을 알아보자.</h3>
<p>귤 종류 중에서 제일 좋아하는 한라봉 나같이 신맛을 싫어하는 사람들에게는 아주 달달한 과일이다. 과육의 질감은 오렌지처럼 약간 단단한 편이고 물기가 많아
차게 먹으면 아주 시원하다.</p>
</div>
<div class="card__footer">
<h4>한라봉 박사 <em> Resources </em></h4>
<span><img src="img/card_bg03_05.jpg" alt="프로필"></span>
</div>
</article>
<article class="card">
<figure class="card__header">
<img src="img/card_bg03_3.jpg" alt="#">
<figcaption>mandarin </figcaption>
</figure>
<div class="card__contents">
<h3>귤(mandarin) 의 대하여 알아보자.</h3>
<p>감귤나무 열매로 모양은 둥글납작하고 빛깔은 주황 혹은 붉은색이다. 수분이 풍부하고 매우 맛있다. 겨울 제철 과일이다. 쪼물딱 거리고 먹으면 더욱 맛있다.
</div>
<div class="card__footer">
<h4>귤 박사 <em> 9 Resources </em>
<span><img src="img/card_bg03_3.png" alt="프로필"></span>
</div>
</article>
</div>
</section>
CSS 유형
figcaption을 써 이미지 안에 카테고리 를 만들었다.
.card__inner .card:nth-child(1) 안에 border-right: 1px solid #eee; 을 써 구분하는 선을 추가한다. '1'을 '2'로 바꾸면 선 2개 추가...
.card__footer 에는 h4,em을 넣어 위치를 설정하고 span을 사용해 이미지 크기와 위치를 설정한다.
justify-content 에는 메인축 방향으로 아이템을 정렬하는 속성이다. flex-end를 주어 오른쪽으로 붙여준다.
/* fonts */
@import url('https://webfontworld.github.io/score/SCoreDream.css');
.score {
font-family: 'SCoreDream';
font-weight: 300;
}
/* reset */
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: #000;
}
img {
width: 100%;
}
h1, h2, h3, h4, h5, h6 {
font-weight: normal;
}
/* common */
.container {
width: 1160px;
padding: 0 20px;
margin: 0 auto;
min-width: 1160px;
}
.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;
}
/* blind */
.blind {
position:absolute;
clip: rect(0 0 0 0);
width: 1px;
height: 1px;
margin: -1px;
overflow: hidden;
}
/* cardType03 */
body {
background-color: #FCAA5B;
}
.card__inner {
display: flex;
}
.card__inner .card {
padding: 26px;
width: 33.3333%;
background-color: #fff;
}
.card__inner .card:nth-child(1) {
border-right: 1px solid #eee;
}
.card__inner .card:nth-child(2) {
border-right: 1px solid #eee;
}
.card__header {
position: relative;
}
.card__header img {
border-radius: 10px;
box-shadow: 4px 4px 5px 0 rgba(0, 0, 0, 0.05);
margin-bottom: 20px;
}
.card__header figcaption {
position: absolute;
right: 10px;
top: 10px;
padding: 6px 16px;
border-radius: 50px;
background-color: #fff;
text-align: center;
font-size: 14px;
color: #FCAA5B;
}
.card__contents h3 {
font-size: 20px;
line-height: 1.4;
margin-bottom: 10px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.card__contents p {
color: #666;
font-size: 16px;
line-height: 1.7;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
margin-bottom: 30px;
}
.card__footer {
display: flex;
justify-content: flex-end;
}
.card__footer h4 {
text-align: right;
color: #FCAA5B;
}
.card__footer em {
display: block;
color: #666;
font-style: normal;
}
.card__footer span {
width: 40px;
height: 40px;
background: #000;
border-radius: 50%;
overflow: hidden;
display: block;
margin-left: 10px;
margin-top: -3px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.25);
}
결과
728x90
댓글