Layout & Design

Stacks vs Grids in Framer (Fundamentals Lesson 8)

Stacks vs Grids in Framer (Fundamentals Lesson 8)

Stacks vs Grids in Framer (Fundamentals Lesson 8)

Joseph

·

7:46

·

59K views

·

About this lesson

Stacks and Grids are two powerful layout tools that help you arrange elements in your designs. They’re both used to create flexible and responsive layouts, but they differ a bit in functionality and are suited to slightly different use cases.

In the previous lesson, we talked about Stacks — but let’s talk about how Grids compare — and get comfortable with the basics of how they work.

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=0s Intro

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=3s Stacks vs grids overview

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=22s High-level differences between stacks and grids

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=55s Creating a grid layout

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=92s Anatomy of a grid

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=118s Fixed vs auto column settings

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=143s Setting rows and columns

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=172s How fill container height works

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=201s Sizing conflicts in grids

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=235s Gaps and padding in grids

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=259s Rearranging grid items

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=286s Spanning rows and columns

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=319s Sizing and positioning within grid cells

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=364s Using absolute positioning inside grids

https://www.youtube.com/watch?v=gqjlM_yCVWo&t=435s Wrap up

🌞 Start for free: https://framer.link/yt

📚 Learn more at: https://framer.link/yt-academy

💎 Join the Community: https://framer.link/yt-community

🎉 Follow on X: https://framer.link/yt-x

0:00stacks and grids are two powerful layout0:02tools that help us arrange elements in0:04our designs they are both used to create0:07flexible and responsive layouts but they0:09differ a bit in functionality and are0:11suited to slightly different use cases0:13in the previous lesson we talked about0:15Stacks but now let's talk about how0:18grids compare and get comfortable with0:20the basics of how they0:23[Music]0:24work let's start with a highle look at0:27the difference between stacks and grids0:30as we learned in the previous lessons0:32Stacks are used to arrange elements in0:33either a vertical column or a horizontal0:36Row one or the other great for simple0:39layouts where you want items to flow in0:41a single Direction Stacks automatically0:44handle spacing alignment and0:46distribution of their child elements0:48making it easy to create consistent0:50layouts if you're familiar with HTML and0:52CSS Stacks are based on Flex box grids0:56on the other hand offer a more complex0:58and structured way to arrange elements1:00in a two-dimensional layout with both1:02rows and columns so grids are great for1:06layouts where we need to distribute and1:07align elements both horizontally and1:10vertically think more complex layouts1:12like dashboards image Galleries and even1:16feature bentos because grids allow us to1:18decide how many rows or columns and1:20items spans across in the world of HTML1:23and CSS grids are based on CSS grid but1:27a bit simplified in framer to make them1:29easier to work with1:30let's look at how to create a grid1:32layout much like Stacks we can start1:34with any old frame add a layout on the1:37properties panel then just switch the1:40layout from stack to grid alternatively1:43we can draw a frame with a grid layout1:45already applied using the grid tool in1:47the layout menu of the toolbar or by1:50pressing shift G on the keyboard then1:53clicking and dragging to draw our1:55grid before we go any further let's look1:57at the anatomy of a grid when we're2:00looking at a grid like this one it looks2:02like we have two structural levels to2:04the hierarchy the parent frame with the2:06grid layout applied to it and the2:08immediate child layers of the grid which2:10flow left to right top to bottom let's2:12call these grid items but there's2:15actually a third thing going on in2:17between what makes this Frame a grid in2:19the first place is that it contains2:21invisible rows and columns that form2:23invisible grid cells which behave like2:26containers and hold each grid item these2:29containers might be invisible but2:31they're very real because when we decide2:34how to size and position each grid item2:36we're doing so in relation to these2:38invisible containers so naturally we got2:41to acknowledge they exist in this2:43example I've made a slightly bigger grid2:45with 12 frames inside as grid items for2:48us to play with each one is set to fill2:50the height and width of its cell which2:52makes it really easy to see the size and2:54shape of each cell now let's play with2:56the properties of the grid Itself by2:58default grids have a fixed number of3:00rows and columns I say by default3:03because under the advanced settings3:04you'll actually find a toggle to switch3:06between having a fixed number of columns3:08or automatically cramming in as many3:11columns as will fit into the available3:13space we're not going to dig too far3:14into the advanced settings in this3:16lesson just know that these settings are3:18here for you and might be worth3:19exploring depending on what you're3:20trying to build with one of these fixed3:23grids we get to choose how many columns3:25and rows we want when we change the3:27number of columns the number of rows3:29will actually adjust automatically to3:31make room for all the grid items we can3:33add or remove rows but can't create too3:35few rows for the number of grid items we3:37have this also makes it easy to override3:40the number of columns to fit better in3:42smaller break points without having to3:44worry about doing the math for the right3:45number of rows in fact if we add more3:48grid items later additional rows will3:50get added automatically you'll notice3:53that as we add more rows each row is3:55shrinking to make room if we go to the3:58advanced settings we can see why this is4:00happening by default height is set to4:03fill container which means all of these4:05rows are trying to grow to fill the4:07height of the grid frame we can also set4:10a fixed height or choose to fit the4:13height of the content of each row but we4:15don't really have any content at the4:16moment that can support the height of4:18each row so I'll leave this set to fill4:20container on that note much like Stacks4:23it's possible to create a sizing4:25conflict between the height of the grid4:27itself and its rows or between height of4:30the rows and the content that's within4:32them you may remember this from the4:33previous lesson that fit content can4:36conflict with fill sizing since someone4:39has to be in charge of the size or else4:40the layout collapses in on itself the4:43same phenomenon is at play with grids if4:46the height of the whole grid is set to4:47fit content the height of the rows can't4:50be set to fill container similarly the4:53height of a grid item can't be set to4:55fill if the rows themselves are set to4:57fit content just like with stacks5:00okay back to the basic properties again5:03similar to Stacks grids allow us to5:05define the gaps between things we get a5:07single field to determine the gaps5:09between both the columns and the rows5:12then padding allows us to add a cushion5:14of space around the inside of the grid5:16frame again just like Stacks another5:19similarity between stacks and grids is5:21that we can click and drag items to5:23rearrange them we also get these nice5:26little control handles we can drag to5:28avoid grabbing the wrong layer by5:30mistake or we can rearrange layers on5:32the layers panel and even use the arrow5:34keys to nudge the selected layer up or5:37down the Sorting order the immediate5:39child layers of a grid again we'll call5:41these grid items occupy those invisible5:44grid cells I mentioned but where things5:46get interesting is that we can decide5:48how many columns and rows they span5:51across you can even make a grid items5:54span the full width of the grid by5:56choosing all5:57columns we can still drag to rearrange6:00things visually and change the Sorting6:01order and the grid will adjust this is6:04what makes grids a great choice for6:06creating Bento layouts or any grid6:09layout for that matter where some items6:10need to be given more real estate than6:12others okay so that changed the size of6:15the invisible cell container that the6:17grid item occupies then we also get to6:20decide the size and position of the grid6:22item within that container we have our6:25usual sizing options of fixed relative6:28fill and fit content you can see that6:31with fill the layer fills the entire6:33width or height of the invisible cell6:35container it occupies but when we change6:38a dimension to fixed or relative its6:41size can now differ from its container6:43which gives us a new position control to6:45decide how the element will be aligned6:48within the container you might be6:50thinking can I switch to Absolute6:51positioning to move this around wherever6:53I want inside the cell remember what6:56happens when we switch a child of a6:57stack to Absolute positioning it removes7:00it from the flow of the stack same thing7:02happens with7:03grids if you do need to get some7:05absolute position layers within a grid7:07cell you can leave the immediate child7:09layer of the grid set to relative and7:12Nest absolute layers within that so now7:15you've got an idea of how grids differ7:18from stacks and why in some cases you7:20may want to use a grid layout instead7:23with both stacks and grids in your tool7:25set you'll be ready to tackle just about7:27any layout you set out to create there7:29are just a few more sizing and7:30positioning modes for us to look at in7:32the next couple of lessons I'll see you7:34there

Watch on YouTube ↗

More in this topic

8 Framer shortcuts you're probably sleeping on4:19
8 Framer shortcuts you're probably sleeping on
Layout & Design3K views · 2 months ago
Framer Update: Stack Sorting and Bento Grids2:16
Framer Update: Stack Sorting and Bento Grids
Framer Update7K views · 2 months ago
Sharing Vector Sets Across Projects (Vectors Lesson 7)3:41
Sharing Vector Sets Across Projects (Vectors Lesson 7)
Layout & Design1K views · 3 months ago
Connecting Vector Sets to the Framer CMS (Vectors Lesson 6)3:38
Connecting Vector Sets to the Framer CMS (Vectors Lesson 6)
Layout & Design2K views · 3 months ago
Animating Vectors in Framer (Vectors Lesson 5)4:25
Animating Vectors in Framer (Vectors Lesson 5)
Layout & Design4K views · 3 months ago
Customizing Vectors with Variables in Framer (Vectors Lesson 4)4:59
Customizing Vectors with Variables in Framer (Vectors Lesson 4)
Layout & Design3K views · 3 months ago
Replace component instances site-wide in Framer1:39
Replace component instances site-wide in Framer
Layout & Design4K views · 4 months ago
Creating and Organizing Vector Sets in Framer (Vectors Lesson 3)6:58
Creating and Organizing Vector Sets in Framer (Vectors Lesson 3)
Layout & Design3K views · 4 months ago

Create a free website with Framer, the website builder loved by startups, designers and agencies.