Загрузка...

3 trucos avanzados css grid

Download 1M+ code from https://codegive.com/813ecc7
css grid is a powerful layout system that allows for complex web designs with relative ease. here are three advanced tricks you can use with css grid, complete with code examples.

1. **grid item overlapping**

you can make grid items overlap each other by using the `grid-area` property. this is useful for creating layered designs or showing content that should be visually distinct.

example:

```html
!doctype html
html lang="en"
head
meta charset="utf-8"
meta name="viewport" content="width=device-width, initial-scale=1.0"
titlegrid overlapping/title
style
.container {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(3, 100px);
grid-gap: 10px;
position: relative;
}
.item1 {
grid-area: 1 / 1 / 3 / 3; /* row-start / column-start / row-end / column-end */
background: lightcoral;
}
.item2 {
grid-area: 1 / 2 / 3 / 5; /* overlaps item1 */
background: lightblue;
opacity: 0.7;
}
.item3 {
grid-area: 2 / 1 / 3 / 2;
background: lightgreen;
}
/style
/head
body
div class="container"
div class="item1"item 1/div
div class="item2"item 2/div
div class="item3"item 3/div
/div
/body
/html
```

2. **responsive grid with auto-fill**

using the `repeat(auto-fill, minmax())` function allows you to create responsive grid layouts that adapt to the available space. this is particularly useful for galleries or cards.

example:

```html
!doctype html
html lang="en"
head
meta charset="utf-8"
meta name="viewport" content="width=device-width, initial-scale=1.0"
titleresponsive grid/title
style
.container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
grid-gap: ...

#CSSGrid #TrucosAvanzados #windows
css grid
advanced css grid
grid layout techniques
responsive design
css grid tutorial
grid template
nested grids
alignment in css grid
css grid gaps
grid areas
media queries
css grid best practices
flexbox vs grid
layout strategies
modern web design

Видео 3 trucos avanzados css grid канала CodeFix
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять