все гайды
Cегодня новый туториал по созданию карточки товара
Задача
Стильная карточка товара повышает переход на этот товар и следовательно возможность продажи потенциальному клиенту. Создадим карточку товара используя только css и html.
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Card</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="card transition">
<h2 class="transition">Victoria Beckham</h2>
<p>Blouse with ties from Victoria Beckham (Victoria Beckham).</p>
<div class="cta-container transition"><a href="#" class="cta">Bay now</a></div>
<div class="card_circle transition"></div>
</div>
</body>
</html>
CSS
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
body {
font-family: Inter, Inter;
background: #eee;
}
.transition {
transition: .3s cubic-bezier(.3, 0, 0, 1.3)
}
.card {
background-color: #fff;
bottom: 0;
height: 300px;
left: 0;
margin: auto;
overflow: hidden;
position: absolute;
right: 0;
top: 0;
width: 300px;
}
.card:hover {
height: 450px;
width: 300px;
}
.card:hover .cta-container {
display: inline;
margin-top: 380px;
}
.card:hover .card_circle {
background: url('https://cdn-images.farfetch-contents.com/16/18/57/29/16185729_32395094_1000.jpg') no-repeat center;
background-size: contain;
border-radius: 0;
margin-top: 0;
height: 300px;
}
.card:hover h2 {
background: #E2B1C0;
color: #fff;
margin-top: 260px;
padding: 5px;
}
.card:hover h2 small {
color: #fff
}
.card:hover p {
margin-top: 320px
}
.card_circle {
background-color: #E2B1C0;
background-size: cover;
border-radius: 50%;
height: 400px;
margin-left: -75px;
margin-top: -270px;
position: absolute;
width: 450px;
}
h2 {
color: #E2B1C0;
font-family: 'Inter', sans-serif;
font-size: 24px;
font-weight: 200;
margin-top: 150px;
position: absolute;
text-align: center;
width: 100%;
z-index: 9999;
}
p {
color: rgba(0, 0, 0, .6);
font-family: 'Inter', sans-serif;
font-size: 100%;
font-weight: normal;
margin-top: 200px;
position: absolute;
text-align: center;
z-index: 9999;
padding: 0 16px;
}
.cta-container {
display: none;
margin-top: 320px;
position: absolute;
text-align: center;
width: 100%;
z-index: 9999;
}
.cta {
-moz-border-radius: 2px;
-moz-transition: 0.2s ease-out;
-o-transition: 0.2s ease-out;
-webkit-border-radius: 2px;
-webkit-transition: 0.2s ease-out;
background-clip: padding-box;
border: 2px solid #E2B1C0;
border-radius: 2px;
color: #E2B1C0;
display: inline-block;
font-family: 'Inter', sans-serif;
font-size: 17px;
font-weight: 400;
height: 36px;
line-height: 36px;
margin-bottom: 15px;
padding: 0 2rem;
text-decoration: none;
text-transform: uppercase;
transition: 0.2s ease-out;
}
.cta:hover {
background-color: #E2B1C0;
box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
color: #fff;
-moz-box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
-webkit-box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}