📋 Шпаргалки по веб-разработке
Готовый синтаксис под рукой: 10 шпаргалок по
PHP 8, JavaScript (ES2024), TypeScript, CSS, SQL (PostgreSQL/MySQL), Git, Linux / Bash, Docker, React, Laravel.
🎨 CSS
СЕЛЕКТОРЫ
| Базовые | .class #id tag * |
|---|
| Комбинации | .a .b (потомок) .a > .b (ребёнок) .a + .b (сосед) |
|---|
| Состояния | :hover :focus :active :disabled :checked |
|---|
| Структура | :first-child :last-child :nth-child(2n) |
|---|
| Отрицание / родитель | :not(.x) :has(img) |
|---|
| Атрибуты | [type="text"] [href^="https"] |
|---|
| Псевдоэлементы | ::before ::after ::placeholder |
БЛОЧНАЯ МОДЕЛЬ
| Сброс | * { box-sizing: border-box; margin: 0; padding: 0 } |
|---|
| Внутри / снаружи | padding: 16px; margin: 0 auto; |
|---|
| Рамка / скругление | border: 1px solid #ddd; border-radius: 12px; |
|---|
| Размеры | width max-width min-height aspect-ratio: 16/9 |
|---|
| Переполнение | overflow: hidden | auto | scroll |
|---|
| Тень | box-shadow: 0 4px 12px rgba(0,0,0,.15); |
FLEXBOX
| Включить | display: flex; gap: 16px; |
|---|
| Направление | flex-direction: row | column |
|---|
| По главной оси | justify-content: center | space-between |
|---|
| По поперечной | align-items: center | stretch | flex-start |
|---|
| Перенос | flex-wrap: wrap |
|---|
| Ребёнок | flex: 1; flex-shrink: 0; min-width: 0; |
|---|
| Центрирование | display:flex; justify-content:center; align-items:center |
GRID
| Колонки | grid-template-columns: repeat(3, 1fr) |
|---|
| Адаптивно | repeat(auto-fill, minmax(280px, 1fr)) |
|---|
| Отступы | gap: 20px; row-gap column-gap |
|---|
| Области | grid-template-areas: "header header" |
|---|
| Занять ячейки | grid-column: span 2; grid-row: 1 / 3; |
|---|
| Центр всего | display: grid; place-items: center; |
ТИПОГРАФИКА И ЦВЕТ
| Шрифт | font-family: 'Inter', sans-serif; font-weight: 600 |
|---|
| Размер резиновый | font-size: clamp(16px, 2.5vw, 24px) |
|---|
| Межстрочный | line-height: 1.6 |
|---|
| Обрезка текста | text-overflow: ellipsis; white-space: nowrap |
|---|
| Цвета | color: #333; background: rgba(0,0,0,.5) |
|---|
| Градиент | background: linear-gradient(90deg, #f00, #00f) |
|---|
| Переменные | :root { --bg: #fff } → var(--bg) |
ПОЗИЦИОНИРОВАНИЕ И АНИМАЦИЯ
| Позиция | position: relative | absolute | fixed | sticky |
|---|
| Координаты | top: 0; left: 0; inset: 0; z-index: 10 |
|---|
| Липкий блок | position: sticky; top: 20px; |
|---|
| Плавность | transition: all .2s ease; |
|---|
| Трансформация | transform: translateY(-4px) scale(1.02) rotate(3deg) |
|---|
| Анимация | @keyframes fade { from{opacity:0} } animation: fade .3s |
АДАПТИВ
| Медиазапрос | @media (min-width: 768px) { } |
|---|
| Тёмная тема | @media (prefers-color-scheme: dark) { } |
|---|
| Контейнерный | @container (min-width: 400px) { } |
|---|
| Мобильный вьюпорт | <meta name="viewport" content="width=device-width"> |
|---|
| Картинка | img { max-width: 100%; height: auto; object-fit: cover } |