/
llrr
/
lab4
Обзор
Документация
Войти
/
llrr
/
lab4
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
style.css
275 строк
6 KB
llrr
Create: index.html, style.css, normalizion.css
14 июн 2026, 21:52
Верифицирован
14 июн 2026, 21:52
ef0d2cd
Код
Авторство
О чём код?
/* Подключение шрифта Google Fonts (с поддержкой кириллицы) */ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700;900&display=swap'); /* Глобальные стили - box-sizing уже задан! */ * { margin: 0; padding: 0; box-sizing: border-box; /* ✅ требование ЛР4 - уже есть */ } body { font-family: 'Roboto', sans-serif; font-size: 18px; font-weight: 400; line-height: 1.6; text-align: left; color: #1e2a3a; background-color: #f5f7fa; /* РАЗМЕРЫ для body (✅ требование ЛР4) */ max-width: 1200px; min-width: 320px; /* минимальная ширина */ width: 90%; /* ширина в процентах */ margin: 0 auto; padding: 20px; /* ПОЗИЦИОНИРОВАНИЕ (относительное) */ position: relative; } /* Стили для заголовков */ h1, h2, h3 { font-weight: 700; text-align: center; margin-bottom: 20px; color: #0d3b66; } h1 { font-size: 2.5rem; margin-top: 0; } h2 { font-size: 2rem; border-bottom: 3px solid #0d3b66; display: inline-block; padding-bottom: 5px; } /* Стили для параграфов */ p { margin-bottom: 15px; text-align: justify; } /* Стили для ссылок */ a { text-decoration: none; color: #1e6f5c; font-weight: 500; transition: all 0.3s ease; } a:hover { color: #289672; text-decoration: underline; } /* Стили для навигации - добавляем z-index */ nav { background-color: #0d3b66; padding: 15px; text-align: center; border-radius: 10px; margin: 20px 0; /* ПОЗИЦИОНИРОВАНИЕ (липкое меню) */ position: sticky; top: 0; z-index: 100; /* ✅ требование ЛР4 - слой выше всех */ } nav a { color: white; margin: 0 10px; } nav a:hover { color: #f0a500; text-decoration: none; } /* Стили для секций - добавляем размеры и позиционирование */ section { background-color: white; padding: 25px; margin-bottom: 30px; border: 1px solid #d1d8e0; border-radius: 15px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); /* ✅ РАЗМЕРЫ для секций (требование ЛР4) */ width: 100%; min-height: 250px; /* минимальная высота */ /* ✅ ПОЗИЦИОНИРОВАНИЕ (относительное для вложенных absolute) */ position: relative; } /* Добавляем декоративный элемент в каждую секцию с absolute positioning */ section::before { content: "★"; position: absolute; top: -15px; left: 20px; font-size: 30px; color: #0d3b66; background-color: white; padding: 0 10px; border-radius: 50%; z-index: 1; } /* Стили для изображения - добавляем размеры */ img { display: block; max-width: 100%; min-width: 200px; /* ✅ минимальная ширина */ height: auto; max-height: 500px; /* ✅ максимальная высота */ width: 80%; /* ✅ ширина в процентах */ margin: 20px auto; border-radius: 12px; border: 2px solid #d1d8e0; /* ✅ ПОЗИЦИОНИРОВАНИЕ (относительное для эффектов) */ position: relative; } /* Эффект при наведении на картинку */ img:hover { transform: scale(1.02); transition: transform 0.3s ease; } /* Стили для списка */ ul { margin: 20px 0 20px 30px; } li { margin-bottom: 10px; } li strong { color: #0d3b66; } /* Стили для ссылок в секции достопримечательностей */ section#attractions a { display: inline-block; margin: 10px 0; padding: 8px 15px; background-color: #e9ecef; border-radius: 25px; font-weight: bold; } section#attractions a:hover { background-color: #0d3b66; color: white; text-decoration: none; } /* ✅ НОВЫЙ БЛОК: Плавающая кнопка (fixed positioning) */ .floating-button { position: fixed; bottom: 30px; right: 30px; background-color: #0d3b66; color: white; width: 60px; height: 60px; border-radius: 50%; text-align: center; line-height: 60px; font-size: 30px; cursor: pointer; z-index: 1000; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.2); } .floating-button:hover { background-color: #1e6f5c; transform: scale(1.1); } /* ✅ НОВЫЙ БЛОК: Абсолютно позиционированная подпись к картинке */ .image-caption { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background-color: rgba(0,0,0,0.7); color: white; padding: 5px 15px; border-radius: 20px; font-size: 14px; z-index: 2; } /* ✅ Обертка для картинки (чтобы absolute работал корректно) */ .image-wrapper { position: relative; display: inline-block; width: 100%; text-align: center; } /* Стили для header */ header { position: relative; z-index: 1; } /* Стили для footer (добавим в HTML) */ footer { background-color: #0d3b66; color: white; text-align: center; padding: 20px; margin-top: 40px; border-radius: 10px; /* Размеры */ width: 100%; min-height: 80px; } footer a { color: #f0a500; } footer a:hover { color: white; } /* Адаптивность */ @media (max-width: 768px) { body { font-size: 16px; padding: 10px; width: 95%; } h1 { font-size: 2rem; } section { padding: 15px; min-height: 200px; } .floating-button { width: 50px; height: 50px; line-height: 50px; font-size: 24px; bottom: 20px; right: 20px; } }