正在加载视频...

视频加载失败

Are you using position: absolute; to overlap elements? It's almost always better to Use CSS Grid instead!

302,109 次观看 • 1 年前 •via X (Twitter)

11 条评论

Wes Bos 的头像
Wes Bos1 年前

Second video! Your questions + tips

Bruno Stasse 的头像
Bruno Stasse1 年前

And you can make it more concise with grid-area: 1 / 1;

Wes Bos 的头像
Wes Bos1 年前

👌😮‍💨 even better

trash 的头像
trash1 年前

i’m using absolute like i’m coding in the stone ages

Wes Bos 的头像
Wes Bos1 年前

absolute: chad;

James Landrum 的头像
James Landrum1 年前

It’s a hack but a hack that I love. And one that technically the layout engine is purposely written to support.

Wes Bos 的头像
Wes Bos1 年前

hah yeah, I'm not sure I'd even call it a hack - its a feature of CSS grid to have multiple items on grid rows/cols

Caleb Porzio 的头像
Caleb Porzio1 年前

My guy, this is fantastic

Wes Bos 的头像
Wes Bos1 年前

thanks my guy!

Alex Parra 的头像
Alex Parra1 年前

Cool demo! I dreamt of this back in 2017 And in 2020 posted it was possible with grid. There’s likely updates I need to make to that posts.

Wes Bos 的头像
Wes Bos1 年前

Awesome! I also included it in my course back then too. Just re-surfacing as I still don't see it used a ton

相关视频