## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; }## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; }## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; }## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; }## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; } ## The Old Way vs. The New Way For years, we relied on `float`, `clear`, and hacky grid frameworks (remember Bootstrap col-md-4?). Then came Flexbox, which was amazing for 1-dimensional layouts (rows OR columns). But for complex, magazine-style layouts, we needed something more robust. ## Welcome to CSS Grid CSS Grid is the first CSS module created specifically to solve the layout problems we've been hacking around for as long as we've been making websites. ### Key Concepts * **The Container:** `display: grid;` activates the grid context. * **Template Columns:** `grid-template-columns: 1fr 2fr 1fr;` defines three columns where the middle one is twice as wide as the others. The `fr` unit stands for "fraction" of available space. * **Gap:** `gap: 20px;` handles the spacing between items. No more negative margins! * **Grid Areas:** You can name parts of your grid and simply tell elements where to go. ```css .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer footer"; }