Viewers: in countries Watching now:
Have you wondered if using a CSS framework will speed up your site development? In this course, senior author James Williamson introduces the types of frameworks available—including the most popular choices among working web developers—and provides an honest assessment of the pros and cons to using a framework. He guides you through downloading a framework, setting up a directory structure, and building a framework-based site, such as structuring the HTML and working with forms. A separate chapter explores layout grids, often included with CSS frameworks, which provide a simple system for laying out page content.
It would be nice if laying out pages with CSS were easier. As it is, the quirks of crafting float-based layouts can be challenging, even for the most experienced designers. So while we wait on support for new layout models like Flexbox and CSS grid Templates, it's not unreasonable to look for some way to speed up and simplify the process of crafting page layouts. That's where CSS grid systems come in. A grid system is a collection of styles that allows a designer to control page layout based on using rows and columns. A typical grid system works like this.
Containing elements are used to define a row within the layout, then you apply class attributes to child elements and then span them over the desired number of columns within that row. The grid system will typically be based on a 12- to 16-column grid. The grid could be fixed, meaning the columns are based off of a set width, or they could be fluid or percentage based. Either way, the grid system will have a collection of styles that will float an element and then tell it how many columns to span.
The containing element will then handle clearing the floats and establishing a new section of content. Most frameworks come with built-in grid systems, but there are quite a few stand-alone grids available for designers who want the ease of using grids without the overhead of an entire framework. As with any predefined system, there are pros and cons to using grids. The most obvious pro is the speed with which they let you work. You can often craft a simple layout in seconds by just applying a few classes. They can also reduce the frustration typically involved with pretty more complicated nested layouts as the CSS is written to account for many of the float-based issues that often plague complex layouts.
However, they are not without their downsides. Most grid systems require you to use containing elements for rows and columns. This means the injection of somewhat unnecessary code into your HTML. This can be especially tricky when attempting to utilize a grid system with a CMS that generates a different code structure. Another consideration is the class attributes that grid systems use. The values are usually specific to the grid that forces you to inject a fair amount of non-semantic markup into your code. Grid systems can also be somewhat inflexible if you're using media queries to target multiple screen sizes, because the classes are tied to a specific column value, it can be difficult to create layouts that shift significantly from one screen size to the next.
In many ways, grid systems are much like the frameworks that often contain them. Some designers swear by them, while others see them as adding unnecessary weight to their code. If you have never used one, I recommend trying one out to see it increases your efficiency and fits with your design philosophy.
There are currently no FAQs about CSS: Frameworks and Grids.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.