CSS Grid trick that’s worth remembering

CSS Grid trick that’s worth remembering

Kevin Powell

1 год назад

255,978 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

tony tony101
tony tony101 - 31.08.2023 22:03

Love love loveee this.

Ответить
Snich
Snich - 13.07.2023 19:26

Remembered this vid cos I had trouble with position-absolute trick. Much easier, much better.

Ответить
Psycho op
Psycho op - 04.07.2023 01:55

❤️❤️

Ответить
Idaho
Idaho - 07.04.2023 15:38

Haha, greatest tip of the day for me. After fighting with multiple mask div, positions and z-index this become trivial 😀

Ответить
Roland Lawrence
Roland Lawrence - 25.01.2023 19:55

im seriously getting to love grid as my current project is a housing management system.

Ответить
Rui Rodrigues
Rui Rodrigues - 11.01.2023 16:20

what if I have more than 1 element inside and want to center it all respecting the flow?

Ответить
PD2M1L10thenoob
PD2M1L10thenoob - 18.12.2022 17:55

Man fuck html

Ответить
Quorun Q
Quorun Q - 09.12.2022 19:25

why not give class staked background-img?
then display justify and align center

Ответить
Cristian
Cristian - 13.11.2022 03:33

I’ve been watching his videos for a while and only now i realized i wasn’t subscribed😅

Ответить
Αυƚυɱɳ
Αυƚυɱɳ - 20.10.2022 17:13

I'm 🔙

Ответить
Nature Medic
Nature Medic - 17.10.2022 22:12

If we can build websites using html & CSS for which part of the website do we need Js for?

Ответить
NDEs debunk cancerous religion and materialism
NDEs debunk cancerous religion and materialism - 17.10.2022 12:08

Very nice loop! :3

Ответить
Digital Cipher
Digital Cipher - 15.10.2022 11:05

That's genius! I love grid now actually

Ответить
Sean Simpson
Sean Simpson - 12.10.2022 10:08

.parent-div {
Display: grid;
Place-content: center;
Height: 100vh}
Now you have vertically centred content 🎉

Ответить
Chris Kramer
Chris Kramer - 11.10.2022 07:16

Whats the disadvantage of using absolute positioning?

Ответить
Hamza Râjput
Hamza Râjput - 06.10.2022 23:51

That's a fkg fine loop

Ответить
BIG BRAIN
BIG BRAIN - 28.09.2022 22:16

Now, how you center div

Ответить
Pvt. Duckling
Pvt. Duckling - 28.09.2022 16:24

What an unbelievably good timing for this one to pop up...
I don't care if this is the "right" way of doing it, it works and that's all I care about

Ответить
Digital CEO
Digital CEO - 27.09.2022 23:00

Oh my! Kevin. Is this real? Wowza!! 🎉

Ответить
ako
ako - 23.09.2022 04:33

Dude pls low the resolution I can see your soul and I don't like it XD

Ответить
Gary
Gary - 22.09.2022 20:33

What’s wrong with using position absolute? It’s much simpler.

Ответить
Eric M
Eric M - 22.09.2022 04:24

Only problem is totally breaks printing, so don't use it with printing as page breaks don't work inside grid or flex.

Ответить
T 25
T 25 - 20.09.2022 23:51

🔥

Ответить
Paul Bystrzan
Paul Bystrzan - 20.09.2022 01:14

I hate it for centering, witch is not centering as we thinking ;)

Ответить
slemps
slemps - 19.09.2022 15:47

man this is the longest short ive ever watched. cant wait to see how it ends.

Ответить
Kris
Kris - 19.09.2022 08:01

Very cool ‘why’ loop

Ответить
print(SKS)
print(SKS) - 17.09.2022 06:45

Which ide you used in this video

Ответить
maker._
maker._ - 16.09.2022 06:21

Infinite loop

Ответить
Ahhhh!
Ahhhh! - 16.09.2022 04:55

What is your VS code theme?

Ответить
BrandonAB
BrandonAB - 15.09.2022 21:40

I love your videos

Ответить
Tim
Tim - 15.09.2022 21:02

Never thought of using grid for a case like this before. Absolutely brilliant. Mind is blown, thanks!

Ответить
Pvkom 26
Pvkom 26 - 15.09.2022 10:34

Incredible

Ответить
Johan de Groot
Johan de Groot - 14.09.2022 22:14

Been trying this with a video element as background and I can't get it to work :'(

Ответить
Dante
Dante - 14.09.2022 07:32

What does grid-column: 1/-1 and row: 1/-1 do? I tried altering the values, but got no result (tried on codepen)

Ответить
Numan Iftikhar
Numan Iftikhar - 13.09.2022 20:27

html
<div class="stacked"> <h1>Content on top</h1> <img src="" alt=""> </div>
css
.stacked{ display:grid; }
.stacked > *{
grid-column: 1/-1;
grid-row: 1/-1;
/* alternative
grid-area: 1/1; */
}

Ответить
Est0nian
Est0nian - 13.09.2022 08:56

nonononooooo, too perfect loop. stop doing thaaat

Ответить
ABHISHEK DUBEY
ABHISHEK DUBEY - 12.09.2022 19:23

I can't understand this span stuff 1/1 this notation is quite confusing

Ответить
Tim T
Tim T - 12.09.2022 17:33

THANKS A LOT KEVIN! This makes GatsbyImage a lot easier to use as a background! Thanks!

Ответить
Praveen Yadav
Praveen Yadav - 12.09.2022 14:38

Oh osm I see somewhere else but didn't understand but now im. Thanks 👍🏻.
and can you make more example shorts on grid

Ответить
Tech Tips
Tech Tips - 12.09.2022 12:56

You’re bloody good Kevin, great tip

Ответить
Tenta Klaus
Tenta Klaus - 12.09.2022 01:46

Which is whyyy.. took me a second!!

Ответить
The Man
The Man - 11.09.2022 19:45

I see what you've done with the script at the end. :D

Ответить
Benjamin Anderson
Benjamin Anderson - 11.09.2022 17:24

"..which is why..." You are getting very good at these shorts Kevin. 😆

Ответить
Sterin Saji
Sterin Saji - 11.09.2022 08:59

Loop failed successful 😔

Ответить
nnrmnlg
nnrmnlg - 10.09.2022 15:45

I hate shorts so much, can't even save these to a playlist

Ответить
Promise Oneh
Promise Oneh - 10.09.2022 12:47

I love CSS

Ответить
Adrian Ramirez
Adrian Ramirez - 10.09.2022 10:17

what theme is he using? looks very nice

Ответить
Zsko Test
Zsko Test - 10.09.2022 09:28

The image/media is logically interpreted as a background, in which case it may be better to declare it before the content in the html code, so that the z-index + isolate can be omitted to take advantage of the normal flow of the document.

Ответить