Загрузка данных
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Выбери свою кошку</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Верхняя секция 40% высоты экрана -->
<section class="hero">
<h1>Без кота<br>жизнь не та!!!</h1>
</section>
<!-- Нижняя секция с формой -->
<section class="form-section">
<h2>Выберите любимую кошку</h2>
<form class="animal-form">
<!-- Ряд 1 -->
<div class="form-row">
<label class="animal-card">
<input type="checkbox" name="animal" value="tiger" class="visually-hidden">
<span class="card-content">
<img src="https://placekitten.com/230/190" alt="Тигр">
<span class="animal-name">Тигр</span>
</span>
</label>
<label class="animal-card">
<input type="checkbox" name="animal" value="leopard" class="visually-hidden">
<span class="card-content">
<img src="https://placekitten.com/231/190" alt="Леопард">
<span class="animal-name">Леопард</span>
</span>
</label>
<label class="animal-card">
<input type="checkbox" name="animal" value="fox" class="visually-hidden">
<span class="card-content">
<img src="https://placekitten.com/232/190" alt="Лиса">
<span class="animal-name">Лиса</span>
</span>
</label>
<label class="animal-card">
<input type="checkbox" name="animal" value="jaguar" class="visually-hidden">
<span class="card-content">
<img src="https://placekitten.com/233/190" alt="Ягуар">
<span class="animal-name">Ягуар</span>
</span>
</label>
</div>
<!-- Кнопки управления -->
<div class="buttons-row">
<button type="reset" class="btn-reset">Сбросить</button>
<button type="submit" class="btn-submit">Отправить</button>
</div>
</form>
</section>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
/* === Верхняя секция (40% высоты экрана) === */
.hero {
height: 40vh;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
background: rgba(0, 0, 0, 0.3);
}
.hero h1 {
font-size: 84px;
color: white;
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
letter-spacing: 2px;
}
/* === Секция с формой === */
.form-section {
display: flex;
flex-direction: column;
align-items: center;
padding: 50px 20px;
}
.form-section h2 {
font-size: 28px;
color: white;
margin-bottom: 40px;
text-align: center;
}
/* Форма */
.animal-form {
width: 1200px;
max-width: 95%;
display: flex;
flex-direction: column;
align-items: center;
gap: 40px;
}
/* Ряд с карточками - используем Flex */
.form-row {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 30px;
width: 100%;
}
/* Карточка животного (блок width: 270px) */
.animal-card {
width: 270px;
cursor: pointer;
display: block;
}
/* Скрываем нативный checkbox */
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
white-space: nowrap;
clip-path: inset(100%);
clip: rect(0 0 0 0);
overflow: hidden;
}
/* Содержимое карточки */
.card-content {
display: flex;
flex-direction: column;
align-items: center;
background: white;
border-radius: 20px;
padding: 20px 20px 15px 20px;
transition: all 0.3s ease;
border: 3px solid transparent;
}
/* Изображение */
.card-content img {
width: 230px;
height: 190px;
object-fit: cover;
border-radius: 15px;
}
/* Имя животного */
.animal-name {
font-size: 20px;
font-weight: bold;
margin-top: 15px;
color: #333;
}
/* Hover на карточке - бледно-зеленый */
.animal-card:hover .card-content {
background-color: #d4f0d4;
transform: translateY(-5px);
}
/* Выбранный checkbox - стили */
.animal-card input:checked + .card-content {
background-color: #a8e6a8;
border: 3px solid #2e7d32;
box-shadow: 0 0 15px rgba(46, 125, 50, 0.5);
}
.animal-card input:checked + .card-content .animal-name {
color: #1b5e20;
}
/* Ряд с кнопками */
.buttons-row {
display: flex;
justify-content: center;
gap: 30px;
margin-top: 20px;
}
/* Стили кнопок */
button {
width: 150px;
font-size: 18px;
font-family: inherit;
padding: 12px 20px;
border: none;
border-radius: 40px;
cursor: pointer;
transition: all 0.3s ease;
font-weight: bold;
}
.btn-reset {
background-color: #ff9800;
color: white;
}
.btn-reset:hover {
background-color: #e68900;
transform: scale(1.05);
}
.btn-submit {
background-color: #4caf50;
color: white;
}
.btn-submit:hover {
background-color: #45a049;
transform: scale(1.05);
}
/* Адаптация для планшетов и телефонов */
@media (max-width: 1300px) {
.hero h1 {
font-size: 60px;
}
.form-row {
gap: 20px;
}
}
@media (max-width: 768px) {
.hero h1 {
font-size: 40px;
}
.animal-card {
width: calc(50% - 20px);
min-width: 220px;
}
.card-content img {
width: 100%;
height: auto;
max-height: 160px;
}
}
@media (max-width: 480px) {
.hero h1 {
font-size: 32px;
}
.form-section h2 {
font-size: 24px;
}
.animal-card {
width: 100%;
}
.buttons-row {
flex-direction: column;
align-items: center;
}
}