/
githubmirror
/
anime
Обзор
Документация
Войти
/
githubmirror
/
anime
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/auto-layout/cards/index.html
73 строки
2 KB
Julian Garnier
4.5.0
22 июн 2026, 17:32
22 июн 2026, 17:32
34f4179
Код
Авторство
О чём код?
<!DOCTYPE html> <html> <head> <title>Auto layout / Cards / Anime.js</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link href="../../assets/css/styles.css" rel="stylesheet"> <style> body { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 4rem 1rem; min-height: 100lvh; gap: 2rem; font-family: system-ui; background-color: var(--fg-2); } .controls fieldset button { width: 5rem; background-color: var(--bg-4); color: var(--fg-1); } .controls fieldset button:hover { background-color: var(--bg-5); } .controls fieldset button.is-active { background-color: var(--fg-1); color: var(--bg-3); } .container { width: 100%; max-width: 60rem; } #cards { display: grid; gap: 16px; } .card { position: relative; overflow: hidden; border-radius: 8px; } .card img { width: 100%; height: 100%; object-fit: cover; } .card .info { padding: 12px; } .card h3 { margin-bottom: 4px; } /* Tiles: 4-column grid with overlay text */ .tiles { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 200px; } .tiles .card:nth-child(3n) { grid-row: span 2; } .tiles .card:nth-child(5n) { grid-column: span 2; } .tiles .card .info { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.35); color: var(--fg-1); } /* List: vertical list with side-by-side layout */ #cards.list { display: flex; flex-direction: column; align-items: center; } .list .card { display: flex; background: var(--fg-1); width: 400px; color: var(--bg-1); } .list .card img { width: 120px; height: 120px; flex-shrink: 0; } /* Grid: uniform rectangular cards with overlay */ .uniform { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); } .uniform .card { aspect-ratio: 4/3; } .uniform .card .info { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.35); color: var(--fg-1); } </style> </head> <body> <div class="controls"> <fieldset> <button data-view="tiles">Tiles</button> <button data-view="list" class="is-active">List</button> <button data-view="uniform">Grid</button> </fieldset> </div> <div class="container"> <div id="cards" class="list"></div> </div> <script type="module" src="./index.js"></script> </body> </html>