CSS Grid Layout Crash Course

Traversy Media · 2.1M views · 2017 · 27:55

Open on YouTube

Web developmenttutorial

Why Stack Overflow recommends it

Stack Overflow users link it when someone asks about page layout, positioning or image arrangement and a short, practical intro to CSS Grid would solve the problem.

Recommended by 7 people across 6 different months, 2017 to 2021.

What it is

A 28-minute crash course from Traversy Media (Brad Traversy) introducing CSS Grid Layout. It covers how to build grid-based layouts and alignments, going through the properties for grid containers and for grid items. Code files for the tutorial are provided.

What people said

Recommends Anjy · 2017-08 · Stack Overflow · on “How to create such a unit in flexbox?”

You can create that kind of blocks by using CSS grids. There is a really good tutorial about it, which will show you how you can create such boxes just in half an hour. Visit this youTube video tutotial to learn about it. CSS Grid Layout Crash Course [this video] Hope this helps.

Recommends Xavier · 2017-11 · Stack Overflow · on “Div css layout positioning”

I would look into CSS Grids. Just about any layout you want you could achieve using CSS Grids [LINK] and it's not all that much to get a basic layout like this. Here are some tutorials if you're interested: [this video] [LINK] .header { grid-area: header; background: dodgerblue; } .sidenav { grid-area: sidenav; background: green; } .content { grid-area: content; } .text-area { grid-area: text-area; background: gray; } textarea { height: 100%; } .container-fluid { min-height: 500px; display: grid; grid-template-columns: 1fr 2fr; grid-template-areas: "header header" "sidenav content" "sidenav content" "sidenav text-area" } <!-- Bootstrap --> <link rel="stylesheet" href=" [LINK] " integrity="sha384-

Recommends Ikkaom · 2018-03 · Stack Overflow · on “Can a website be created without "position:" tags?”

So far I have created two websites and I can't finish them because of position tags. I have two sidebars and they make the problem. My question is, can a website be created without position: tags? Update: This tutorial helped me a lot. [this video]

Recommends Julius Guttenberg · 2020-04 · Stack Overflow · on “I need to display images next to text”

The quickest way to achieve this would be to use CSS grid <link href="myCSSfile.css" rel="stylesheet" type="text/css"> link a css file to your HTML, put that code inside your header tags. Create 3 divs, one that covers everything within the body, and two subordinate divs which make up the left and right side of the screen HTML <div id="wrapper"> <div class="Pics"> ...lots of pics </div> <div id="text"> ...your text </div> </div> CSS #wrapper{ display: grid; grid-template-areas: "text pics"; grid-template-columns: 60% 40%; } .Pics{ grid-area: pics; } #text{ grid-area: text; } Ultimately, you won't get around to watch a tutorial on CSS Grid or flexbox, like these ones: CSS Grid [this video] or Flex

Recommends Mehul · 2020-07 · Stack Overflow · on “Is there a value of TOP in CSS that can dynamically position an element based on the length of the previous element?”

As of now, there is no way that you can style a div (or any other element for that matter) dynamically on the basis of a previous element. But you have some options here - either you can use Javascript to manage the styles of elements dynamically, or, you can use CSS FlexBox Model or CSS Grid to position and change height/width of elements, which is highly recommended and super powerful for making any layout of your choice. Here are some places which I used to learn flexbox - freeCodeCamp flexbox tut [LINK] Brad Traversy flexbox crash course [LINK] Now for CSS grid- Brad Traversy CSS Grid [this video] freeCodeCamp CSS Grid [LINK]

Recommends Anshuman Yadav · 2021-10 · Stack Overflow · on “How can I design UI in IONIC as shown in the image sample?”

You could use CSS Grid properties to achieve such UI, it really makes our life easier. Learn. try and experiment the things. You'll be easily able to attain such UI. I have attached some useful references below: [this video] [LINK] [LINK] [LINK]

Recommends RudyTheWebDeveloper · 2021-10 · Stack Overflow · on “I want different text in the same line positioned to the left and right inside a table cell”

Even i am a student who has basic knowledge of html css and basic js... using floats for tweaking stuff is fine but for alignment, you should use flexbox or css grid, the best place to learn those is w3schools [LINK] or you could learn it from youtube [LINK] [this video] ps: if you want to position .group and classroom relative to the table cell and not to themselves then change the position to `position: absolute;`

Cites Ibrahim Osama · 2017-12 · Stack Overflow · on “CSS selector for floats that have wrapped to the nth line”

You can give the element class name and don't try using nth-child() a lot because it's bad performance. <div> <div class=floatme one>...</div> <div class=floatme two>...</div> ...(8 more) </div> Also you can use same idea to create gallery image using CSS Grid layout and BEM methodology. CSS Grid Layout: [this video] BEM: [LINK] .

Cites Reyshawn · 2019-06 · Stack Overflow · on “How to resize multiple images side by side to to fit the current screen size?”

Try to use grid system. grid-template-columns defines how many columns you want to divide, in the flowing example I divide 3 columns with the value 1fr 1fr 1fr . grid-gap defines the gaps between each grids. More information about css grid system, you can refer to this Youtube video: [this video] It's very useful when doing some layouts with CSS. .container { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 1em; } .box { border: 1px solid teal; } .box img { width: 100%; height: 100%; } <div class="container"> <div class="box"> <img src="" alt=""> </div> <div class="box"> <img src="" alt=""> </div> <div class="box"> <img src="" alt=""> </div> <div class="box"> <img src="" alt=""> </div