이 제품 카드를 본 적이 없습니다.
데모
I suggest you to view the demo in fullscreen view. click on the top right most button to access fullscreen view.
비디오 튜토리얼
이해하기 어려운 기사를 찾으면. youtube에서 비디오 자습서를 볼 수 있습니다.
If you like the tutorial video. Please subscribe my youtube channel. It will really help me.
코딩해봅시다.
먼저 index.html
, style.css
, app.js
3개의 파일을 생성해야 합니다. 그 후 HTML 파일에 기본 구조를 작성하고 모든 외부 파일을 연결합니다.
이제 시작하겠습니다.
index.html
에서 클래스.card
가 있는 div를 만들고 그 안에 클래스.background-overlay
가 있는 div를 만들고 그 안에 클래스.circle
가 있는 범위를 만듭니다. 우리가 할 일은 .background-overlay
요소의 절대 위치를 지정하고 해당 오버플로를 숨겨 카드의 오버플로 속성에 영향을 주지 않고 반원을 만드는 방법입니다. 이제 내부.card
와 외부background-overlay
에서 클래스.content
가 있는 다른 div를 만듭니다. 그리고 그 안에 h1
, p
및 다른 h1
및 더 많은 div를 만듭니다.
마지막으로 구조는 다음과 같아야 합니다.
<div class="card">
<div class="background-overlay">
<span class="circle"></span>
</div>
<div class="content">
<h1 class="product-name">nike fly</h1>
<img src="shoe.png" class="product-img" alt="">
<h1 class="price">$ 199</h1>
<div class="sizes">
<p class="size">5</p>
<p class="size">6</p>
<p class="size active">7</p>
<p class="size">8</p>
</div>
<div class="btn-container">
<button class="btn buy">buy now</button>
<button class="btn cart">add to cart</button>
</div>
</div>
</div>
그 후 몇 가지 스타일을 제공합니다.
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
width: 100%;
height: 100vh;
min-height: 600px;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
background: #c72734;
font-family: 'roboto', sans-serif;
}
.card{
width: 300px;
height: 450px;
background: #ea2b3b;
border-radius: 20px;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
position: relative;
padding: 40px 20px;
}
.background-overlay{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
overflow: hidden;
border-radius: 20px;
}
.circle{
position: absolute;
top: -170px;
left: 50%;
transform: translateX(-50%);
width: 400px;
height: 400px;
border-radius: 50%;
background: #fff;
}
.content{
position: relative;
}
.product-name{
text-transform: uppercase;
text-align: center;
color: #000;
font-weight: 400;
font-size: 40px;
}
.product-img{
width: 270px;
display: flex;
margin: auto;
margin-top: 100px;
transform: rotate(-40deg);
transition: 1s;
}
.card.active .product-img{
margin-top: 40px;
transform: rotate(-20deg);
}
.price{
opacity: 0;
transform: translateY(40px);
color: #fff;
font-size: 60px;
font-weight: 400;
margin-top: 20px;
transition: 1s;
}
.sizes{
opacity: 0;
transform: translateY(40px);
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
transition: 1s;
}
.size{
color: #000;
background: #fff;
padding: 15px 20px;
border-radius: 10px;
font-size: 20px;
margin-top: 20px;
font-weight: 400;
transition: 1s;
cursor: pointer;
}
.size.active,
.size:hover{
background: #000;
color: #fff;
}
.card.active .price,
.card.active .sizes{
opacity: 1;
transform: translateY(0);
}
.card.active .btn-container{
opacity: 1;
transform: translateY(0);
transition: 1s;
transition-delay: 1s;
}
.btn-container{
opacity: 0;
transform: translateY(40px);
display: block;
position: absolute;
width: calc(100% + 40px);
height: 40px;
bottom: -80px;
left: -20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.btn{
width: 48%;
height: 100%;
border-radius: 10px;
border: none;
outline: none;
text-transform: capitalize;
font-size: 16px;
}
.btn.buy{
background-color: #ea2b3b;
color: #fff;
}
우리 카드가 완성되었습니다. 이제 카드의 .active
클래스를 토글하는 데 사용할 수 있는 오버레이 div를 만들어야 합니다.
따라서 index.html
에서 .card
요소 앞에 클래스 .overlay
가 있는 div를 만듭니다.
<div class="overlay"></div>
이 스타일을 주고
.overlay{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: none;
}
이제 JS를 추가하여 클래스를 토글합니다.
const card = document.querySelector('.card');
const overlay = document.querySelector('.overlay');
card.addEventListener('click', () => {
card.classList.add('active');
overlay.style.display = 'block';
})
overlay.addEventListener('click', () => {
card.classList.remove('active');
overlay.style.display = null;
})
완료되었습니다. 도움이 되셨다면 devto에서 저를 팔로우하고 제 유튜브 채널도 구독해주세요.
If you are interested in programming and want to know how I am a 15yr old teen make these designs. You can follow me on my instagram. I am planning to post my game development experiments on instagram soon.
Source Code , Download Image Only , ,
내가 만든 실수를 발견하거나 의심스러운 점이 있으면 언제든지 댓글로 질문해 주세요.
방문해 주셔서 감사합니다.
Reference
이 문제에 관하여(이 제품 카드를 본 적이 없습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/kunaal438/easy-to-make-this-awesome-product-card-css-2cjc
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
I suggest you to view the demo in fullscreen view. click on the top right most button to access fullscreen view.
이해하기 어려운 기사를 찾으면. youtube에서 비디오 자습서를 볼 수 있습니다.
If you like the tutorial video. Please subscribe my youtube channel. It will really help me.
코딩해봅시다.
먼저 index.html
, style.css
, app.js
3개의 파일을 생성해야 합니다. 그 후 HTML 파일에 기본 구조를 작성하고 모든 외부 파일을 연결합니다.
이제 시작하겠습니다.
index.html
에서 클래스.card
가 있는 div를 만들고 그 안에 클래스.background-overlay
가 있는 div를 만들고 그 안에 클래스.circle
가 있는 범위를 만듭니다. 우리가 할 일은 .background-overlay
요소의 절대 위치를 지정하고 해당 오버플로를 숨겨 카드의 오버플로 속성에 영향을 주지 않고 반원을 만드는 방법입니다. 이제 내부.card
와 외부background-overlay
에서 클래스.content
가 있는 다른 div를 만듭니다. 그리고 그 안에 h1
, p
및 다른 h1
및 더 많은 div를 만듭니다.
마지막으로 구조는 다음과 같아야 합니다.
<div class="card">
<div class="background-overlay">
<span class="circle"></span>
</div>
<div class="content">
<h1 class="product-name">nike fly</h1>
<img src="shoe.png" class="product-img" alt="">
<h1 class="price">$ 199</h1>
<div class="sizes">
<p class="size">5</p>
<p class="size">6</p>
<p class="size active">7</p>
<p class="size">8</p>
</div>
<div class="btn-container">
<button class="btn buy">buy now</button>
<button class="btn cart">add to cart</button>
</div>
</div>
</div>
그 후 몇 가지 스타일을 제공합니다.
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
width: 100%;
height: 100vh;
min-height: 600px;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
background: #c72734;
font-family: 'roboto', sans-serif;
}
.card{
width: 300px;
height: 450px;
background: #ea2b3b;
border-radius: 20px;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
position: relative;
padding: 40px 20px;
}
.background-overlay{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
overflow: hidden;
border-radius: 20px;
}
.circle{
position: absolute;
top: -170px;
left: 50%;
transform: translateX(-50%);
width: 400px;
height: 400px;
border-radius: 50%;
background: #fff;
}
.content{
position: relative;
}
.product-name{
text-transform: uppercase;
text-align: center;
color: #000;
font-weight: 400;
font-size: 40px;
}
.product-img{
width: 270px;
display: flex;
margin: auto;
margin-top: 100px;
transform: rotate(-40deg);
transition: 1s;
}
.card.active .product-img{
margin-top: 40px;
transform: rotate(-20deg);
}
.price{
opacity: 0;
transform: translateY(40px);
color: #fff;
font-size: 60px;
font-weight: 400;
margin-top: 20px;
transition: 1s;
}
.sizes{
opacity: 0;
transform: translateY(40px);
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
transition: 1s;
}
.size{
color: #000;
background: #fff;
padding: 15px 20px;
border-radius: 10px;
font-size: 20px;
margin-top: 20px;
font-weight: 400;
transition: 1s;
cursor: pointer;
}
.size.active,
.size:hover{
background: #000;
color: #fff;
}
.card.active .price,
.card.active .sizes{
opacity: 1;
transform: translateY(0);
}
.card.active .btn-container{
opacity: 1;
transform: translateY(0);
transition: 1s;
transition-delay: 1s;
}
.btn-container{
opacity: 0;
transform: translateY(40px);
display: block;
position: absolute;
width: calc(100% + 40px);
height: 40px;
bottom: -80px;
left: -20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.btn{
width: 48%;
height: 100%;
border-radius: 10px;
border: none;
outline: none;
text-transform: capitalize;
font-size: 16px;
}
.btn.buy{
background-color: #ea2b3b;
color: #fff;
}
우리 카드가 완성되었습니다. 이제 카드의 .active
클래스를 토글하는 데 사용할 수 있는 오버레이 div를 만들어야 합니다.
따라서 index.html
에서 .card
요소 앞에 클래스 .overlay
가 있는 div를 만듭니다.
<div class="overlay"></div>
이 스타일을 주고
.overlay{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: none;
}
이제 JS를 추가하여 클래스를 토글합니다.
const card = document.querySelector('.card');
const overlay = document.querySelector('.overlay');
card.addEventListener('click', () => {
card.classList.add('active');
overlay.style.display = 'block';
})
overlay.addEventListener('click', () => {
card.classList.remove('active');
overlay.style.display = null;
})
완료되었습니다. 도움이 되셨다면 devto에서 저를 팔로우하고 제 유튜브 채널도 구독해주세요.
If you are interested in programming and want to know how I am a 15yr old teen make these designs. You can follow me on my instagram. I am planning to post my game development experiments on instagram soon.
Source Code , Download Image Only , ,
내가 만든 실수를 발견하거나 의심스러운 점이 있으면 언제든지 댓글로 질문해 주세요.
방문해 주셔서 감사합니다.
Reference
이 문제에 관하여(이 제품 카드를 본 적이 없습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/kunaal438/easy-to-make-this-awesome-product-card-css-2cjc
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
<div class="card">
<div class="background-overlay">
<span class="circle"></span>
</div>
<div class="content">
<h1 class="product-name">nike fly</h1>
<img src="shoe.png" class="product-img" alt="">
<h1 class="price">$ 199</h1>
<div class="sizes">
<p class="size">5</p>
<p class="size">6</p>
<p class="size active">7</p>
<p class="size">8</p>
</div>
<div class="btn-container">
<button class="btn buy">buy now</button>
<button class="btn cart">add to cart</button>
</div>
</div>
</div>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
width: 100%;
height: 100vh;
min-height: 600px;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
background: #c72734;
font-family: 'roboto', sans-serif;
}
.card{
width: 300px;
height: 450px;
background: #ea2b3b;
border-radius: 20px;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
position: relative;
padding: 40px 20px;
}
.background-overlay{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
overflow: hidden;
border-radius: 20px;
}
.circle{
position: absolute;
top: -170px;
left: 50%;
transform: translateX(-50%);
width: 400px;
height: 400px;
border-radius: 50%;
background: #fff;
}
.content{
position: relative;
}
.product-name{
text-transform: uppercase;
text-align: center;
color: #000;
font-weight: 400;
font-size: 40px;
}
.product-img{
width: 270px;
display: flex;
margin: auto;
margin-top: 100px;
transform: rotate(-40deg);
transition: 1s;
}
.card.active .product-img{
margin-top: 40px;
transform: rotate(-20deg);
}
.price{
opacity: 0;
transform: translateY(40px);
color: #fff;
font-size: 60px;
font-weight: 400;
margin-top: 20px;
transition: 1s;
}
.sizes{
opacity: 0;
transform: translateY(40px);
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
transition: 1s;
}
.size{
color: #000;
background: #fff;
padding: 15px 20px;
border-radius: 10px;
font-size: 20px;
margin-top: 20px;
font-weight: 400;
transition: 1s;
cursor: pointer;
}
.size.active,
.size:hover{
background: #000;
color: #fff;
}
.card.active .price,
.card.active .sizes{
opacity: 1;
transform: translateY(0);
}
.card.active .btn-container{
opacity: 1;
transform: translateY(0);
transition: 1s;
transition-delay: 1s;
}
.btn-container{
opacity: 0;
transform: translateY(40px);
display: block;
position: absolute;
width: calc(100% + 40px);
height: 40px;
bottom: -80px;
left: -20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.btn{
width: 48%;
height: 100%;
border-radius: 10px;
border: none;
outline: none;
text-transform: capitalize;
font-size: 16px;
}
.btn.buy{
background-color: #ea2b3b;
color: #fff;
}
<div class="overlay"></div>
.overlay{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: none;
}
const card = document.querySelector('.card');
const overlay = document.querySelector('.overlay');
card.addEventListener('click', () => {
card.classList.add('active');
overlay.style.display = 'block';
})
overlay.addEventListener('click', () => {
card.classList.remove('active');
overlay.style.display = null;
})
If you are interested in programming and want to know how I am a 15yr old teen make these designs. You can follow me on my instagram. I am planning to post my game development experiments on instagram soon.
Reference
이 문제에 관하여(이 제품 카드를 본 적이 없습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/kunaal438/easy-to-make-this-awesome-product-card-css-2cjc텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)