Day 1 | Demo Product Card 

 Thực chiến thiết kế Product Card chưa đến 1 giờ sử dụng HTML , CSS

				
					
	<body>
		<div class="card">
			<span class="like"><i class='bx bx-heart'></i></span>
			<span class="cart"><i class='bx bx-cart-alt' ></i></span>
			<div class="card__img">
				<img decoding="async" src="Nike Zoom KD 12.png" alt="" />
			</div>
			<h2 class="card__title">Nike Zoom KD 12</h2>
			<p class="card__price">$99</p>
			<div class="card__size">
				<h3>Size:</h3>
				<span>6</span>
				<span>7</span>
				<span>8</span>
				<span>9</span>
			</div>
			<div class="card__color">
				<h3>Color:</h3>
				<span class="green"></span>
				<span class="red"></span>
				<span class="black"></span>
			</div>
			<div class="card__action">
				<button>Buy now</button>
				<button>Add cart</button>
			</div>
		</div>
	</body>


				
			
				
					@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

:root {
	--primary-color: #4daf54;
}

* {
	padding: 0;
	margin: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Poppins', sans-serif;
	height: 100vh;
	background-image: linear-gradient(to right, #4daf54, #3d8880);
	overflow: hidden;
}

.card {
	margin: 120px auto;
	width: 320px;
	height: 400px;
	background-color: #272d40;
	border-radius: 15px;
	padding: 40px 20px;
	color: white;
	position: relative;
}

.card__img {
	width: 90%;
	transition: 0.5s;
}

img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.card:hover .card__img {
	transform: translateY(-90px) rotate(-20deg);
}

.card__title {
	color: var(--primary-color);
	transition: 0.5s;
	text-align: center;
}

.card__price {
	font-weight: 600;
	font-size: 26px;
	transition: 0.5s;
	text-align: center;
}

.card:hover .card__title {
	transform: translate(-40px, -72px);
}

.card:hover .card__price {
	transform: translate(-112px, -72px);
}

.card__size,
.card__color,
.card__action {
	opacity: 0;
	visibility: hidden;
	transition: 0.5s;
}

.card__size {
	margin-top: 100px;
}

.card:hover .card__size {
	margin-top: -30px;
}

.card:hover .card__size,
.card:hover .card__color,
.card:hover .card__action {
	transition-delay: 0.2s;
	opacity: 1;
	visibility: visible;
}

.card__size,
.card__color {
	display: flex;
	align-items: center;
	margin-bottom: 15px;
}

.card__size h3,
.card__color h3 {
	font-weight: unset;
	margin-right: 12px;
}

.card__size span {
	padding: 2px 10px;
	background-color: #dadada;
	margin: 0 5px;
	border-radius: 5px;
	color: #272d40;
	cursor: pointer;
}

.card__color span {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	margin: 0 5px;
    cursor: pointer;
}

.card__color span.green {
	background-color: green;
}
.card__color span.red {
	background-color: red;
}
.card__color span.black {
	background-color: black;
}

.card__action button {
	padding: 10px 20px;
	outline: none;
	border: none;
	background-color: var(--primary-color);
	border-radius: 5px;
	cursor: pointer;
	color: white;
	margin-right: 7px;
	font-weight: 600;
	transition: 0.25s;
}

.card__action button:hover {
	transform: scale(0.9);
}


.like, .cart {
	font-size: 25px;
	position: absolute;
	top: 12px;
	left: 20px;
	cursor: pointer;
	z-index: 2;
}

.cart {
	left: unset;
	right: 20px;
}
				
			
LỘ TRÌNH LÊN FULLSTACK, trọn bộ serial course Pro HTML,CSS,JAVASCRIPT MIỄN PHÍ :

HTML : HTML căn bản cho người mới bắt đầu

CSS : CSS căn bản cho người mới bắt đầu

JS: Javascript cho người mới bắt đầu 

 
 
 

Leave a Reply

Your email address will not be published. Required fields are marked *