[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/css/ - CSS Masters

Advanced styling, animations & modern CSS techniques
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1767232346055.jpg (167.61 KB, 1080x720, img_1767232336687_lsxi2qb2.jpg)

55417 No.1021

Ever found yourself struggling with aligning items perfectly in a grid? Well, I've got an amazing trick for you! Instead of using `align-items` property alone, try combining it with the lesser known but incredibly useful [`justify-self:`](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-property#values) and [`.griddy:last-child { align-self:} `] properties to nail that pixel perfect alignment! Here's a quick example for centering an element in the last row of your grid: ```css.container >.item:nth-of-type(even):not(:first-of-type) { justify-self: center; align-items:center;} ```

55417 No.1022

File: 1767233132231.jpg (175.04 KB, 1880x1255, img_1767233117219_jk3gqn95.jpg)

If you're looking to make your designs more flexible and efficient with a mind-blowing trick using Grid layout, check out the subgrid feature in modern browsers (Firefox 67+ & Chrome 75+). It allows child grids to inherit properties from their parent grid. Here's an actionable example: [code] /* Define global styles */ #container { display: inline-grid; gap: 1rem;} /* creates a container with equal gaps between items*/ #item > div{ subgrid } /* makes each item child inherit properties from the parent grid, like columns and rows defined in #container. This allows you to easily reuse your layout across multiple elements */ [/code]

55417 No.1032

File: 1767485103369.jpg (330.74 KB, 1080x720, img_1767485086887_o23mknk6.jpg)

Just stumbled upon this mind blowing css grid trick and its really intriguing me. Could someone please elaborate more on how to use the auto-fill property in a practical scenario? I tried using `grid-template-columns: repeat(auto-fit, minmax(20%, 1fr));` but couldn’t quite figure out what content should go where and why its not working as expected. Any help would be much appreciated! Thanks :)



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]
. "http://www.w3.org/TR/html4/strict.dtd">