CSS Grid Course: Template areas
Skills:
HTML & CSS90%
Key Takeaways
Explains template areas in a CSS Grid course using Scrimba
Full Transcript
heyyyyyy in this screencast you're going to learn really cool feature of CSS grid called template areas which allows you to change an experiment with layouts much more easily than with the techniques you learned in the previous cost this feature is ideal for creating prototypes of layouts quickly we're using more or less the same example from the previous screencast our grid has 12 columns and 3 rows the columns are just as they were in the previous screencast however for the rows I've changed the second one from 200 pixels to Ottawa that means it'll take up whatever available space there is left in the height and combining that with setting the height of the grid container itself to a hundred percent this will result in the grid being responsive in the height as well as you can see if we make it taller the second row grows with the grid now we're still using the grid column property to adjust the position and size of the items what we rather want to do in this screencast is used something called grid area and to be able to do that we're going to have to give the container a grid template areas property and the syntax you're about to see now might seem a bit weird it'll be a visual representation of the grid and the way it works is that we'll create a string for each of the rows and in those strings we'll create a cell for each of the columns so let's add letter H 12 times in the first string we have to give it exactly 12 characters that has to match the amount of columns so we're not actually defining the columns or rows here we've already done that up here we're just naming them so that we can refer them using these names later on in the second row Ladd 1m and elevenses I thought in the third row rad twelve f's what you have here is a visual representation of how we want our grid to look like unless you might have understood the age M C and F refer to header menu content and footer so now let's remove the old way of positioning the items like that and build up the grid over again we'll give the header a grid area of age as you can see as a result the header takes up the entire top row just as we've defined here we'll give the menu a grid area of M content grid area see footer grid area of s as you can see our layout is just the way we want it to be and it's responsive now the reason this technique is brilliant for creating mock-ups is because now I wanna make the menu span all the way to the top like we did in the previous screencast we can just replace this edge here with an M and as you can see automatically the menu popped up to the top if you want to make it span all the way to the bottom let's do the same thing here as well and just as easy as that we have changed layouts without having to fiddle around with the values in the item classes you can also use dots which will result in blank cells like that there there there now we have this weird experimental layout where all the corners are blank now one thing you need to be aware of is that the areas will only be valid if they are rectangled try and manage this to an F so that the F footer goes like that and then up you can see it breaks the entire layout so you have to use rectangles as you understand this is a super simple way of experimenting with the layout so I'd recommend you to play around with these values here so that you make sure that you properly understand it and once you've done that you have finished the first section of this course so congratulations you now know quite a lot about CSS grid however there's still a lot of stuff to learn so in the next section I'm gonna teach you some more advanced stuff and we're gonna create even more responsive grids that'll be super cool so I'll see you there
Original Description
🎓 View our courses: https://scrimba.com/links/all-courses
Check out the full CSS Grid course for free here: https://scrimba.com/g/gR8PTE
Template areas is a super cool way of creating layouts with CSS Grid. It allows you to quickly prototype and experiment with your layout. In this screencast, you'll learn about grid-area and grid-template-areas.
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Scrimba · Scrimba · 12 of 60
1
2
3
4
5
6
7
8
9
10
11
▶
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
CSS Grid Course: Learn the Basics in 3 Minutes
Scrimba
CSS Grid Course: Positioning Items
Scrimba
CSS Grid Course: Why Learn It And How It Compares To Bootstrap
Scrimba
CSS Grid Course: auto-fit & minmax
Scrimba
CSS Grid Course: Implicit Rows
Scrimba
CSS Grid Course: Fraction Units And Repeat
Scrimba
CSS Grid Course: Justify Items and Align Items
Scrimba
CSS Grid Course: An Awesome Image Grid
Scrimba
CSS Grid Course: Named Lines
Scrimba
CSS Grid Course: auto-fit vs auto-fill
Scrimba
CSS Grid Course: Justify Content and Align Content
Scrimba
CSS Grid Course: Template areas
Scrimba
27. Setting up the structure - Responsive CSS Tutorial
Scrimba
25. Making the navigation responsive - Responsive CSS Tutorial
Scrimba
36. Playing with the title's position and negative margins - Responsive CSS Tutorial
Scrimba
31. Starting the CSS for our page - Responsive CSS Tutorial
Scrimba
26. Taking a look at the rest of the project - Responsive CSS Tutorial
Scrimba
15. Spacing out the columns - Responsive CSS Tutorial
Scrimba
33. Starting to think mobile first - Responsive CSS Tutorial
Scrimba
22. Making our navigation look good - Responsive CSS Tutorial
Scrimba
37. Changing image size with object-fit - Responsive CSS Tutorial
Scrimba
44. Module Wrap up - Responsive CSS Tutorial
Scrimba
16. Controlling the vertical position of flex items - Responsive CSS Tutorial
Scrimba
39. Setting up the widgets and talking breakpoints - Responsive CSS Tutorial
Scrimba
42. Setting up the About Me page - Responsive CSS Tutorial
Scrimba
35. Changing the visual order with flexbox - Responsive CSS Tutorial
Scrimba
23. Adding the underline - Responsive CSS Tutorial
Scrimba
21. Using flexbox to start styling our navigation - Responsive CSS Tutorial
Scrimba
20. Creating a navigation - Responsive CSS Tutorial
Scrimba
40. Using a new pseudo class to wrap up the homepage - Responsive CSS Tutorial
Scrimba
43. Fixing up some loose ends - Responsive CSS Tutorial
Scrimba
32. Starting the layout. Looking at the big picture - Responsive CSS Tutorial
Scrimba
24. A more complicated navigation - Responsive CSS Tutorial
Scrimba
28. Feature article structure - Responsive CSS Tutorial
Scrimba
34. Styling the featured article - Responsive CSS Tutorial
Scrimba
18. Making layout responsive with flex direction - Responsive CSS Tutorial
Scrimba
19. flex direction explained - Responsive CSS Tutorial
Scrimba
41. Creating the recent posts page - Responsive CSS Tutorial
Scrimba
17. Media Query basics - Responsive CSS Tutorial
Scrimba
30. Home Page. HTML for the aside - Responsive CSS Tutorial
Scrimba
38. Styling recent articles for large screens - Responsive CSS Tutorial
Scrimba
29. The home page. HTML for the recent articles - Responsive CSS Tutorial
Scrimba
10. ems and rems an example - Responsive CSS Tutorial
Scrimba
1. Starting to think responsively - Responsive CSS Tutorial
Scrimba
4. Controlling the width of images - Responsive CSS Tutorial
Scrimba
5. min width and max width - Responsive CSS Tutorial
Scrimba
3 CSS Units. Percentage - Responsive CSS Tutorial
Scrimba
11. Flexbox refresher and setting up some HTML - Responsive CSS Tutorial
Scrimba
12. Basic Styles and setting up the columns - Responsive CSS Tutorial
Scrimba
8. The Solution Rems - Responsive CSS Tutorial
Scrimba
14. Setting the columns widths - Responsive CSS Tutorial
Scrimba
2 CSS Units - Responsive CSS Tutorial
Scrimba
7. The problem with ems - Responsive CSS Tutorial
Scrimba
6. CSS Units. The em unit - Responsive CSS Tutorial
Scrimba
13. Adding the background color - Responsive CSS Tutorial
Scrimba
9. Picking which unit to use - Responsive CSS Tutorial
Scrimba
Tutorial to Learn Alpine JS - Full Course for Beginners
Scrimba
Guide To Algorithms in Javascript [Binary Search] - Full Course / Tutorial
Scrimba
Learn UI Design [7 Fundamentals Tutorial] - Full Course for Beginners
Scrimba
Javascript Tutorial for Beginners [From 0 to ES6+] - Full Course
Scrimba
More on: HTML & CSS
View skill →Related Reads
📰
📰
📰
📰
Next.js vs Remix vs SvelteKit: Which Framework Should You Learn?
Dev.to · Etrit Neziri
Had my Frontend Developer interview with Capgemini (Application Developer) today, and I wanted to…
Medium · JavaScript
10 Frontend Developer Tools to Boost Productivity in 2026
Medium · Programming
10 Frontend Developer Tools to Boost Productivity in 2026
Medium · JavaScript
🎓
Tutor Explanation
DeepCamp AI