Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Using frameworks and grids

From: CSS Fundamentals

Video: Using frameworks and grids

As you begin to develop web sites, you'll find that you often do the same things over and over again when writing CSS. At a minimum, you'll have to figure out how you want to deal with browser inconsistencies, what type of layout styles to use, and what kind of typographic treatment you'll use for your site. Over time you'll find that you begin to develop a consistent way of handling these issues thorough your styles. In many ways, it would be advantageous to have a templating system in place to speed up the process of generating those styles. Well, that's where CSS frameworks come in.

Using frameworks and grids

As you begin to develop web sites, you'll find that you often do the same things over and over again when writing CSS. At a minimum, you'll have to figure out how you want to deal with browser inconsistencies, what type of layout styles to use, and what kind of typographic treatment you'll use for your site. Over time you'll find that you begin to develop a consistent way of handling these issues thorough your styles. In many ways, it would be advantageous to have a templating system in place to speed up the process of generating those styles. Well, that's where CSS frameworks come in.

CSS frameworks are pre-existing CSS libraries that are designed to give you a starting point for your site's CSS, as well as to give you tools to make page layout and typography faster to implement. There are a lot of different CSS frameworks available, with a wide variety of features, but as a general rule, here's how they work. Most of the frameworks come with a style sheet that contains a base level set of styles. These will typically contain a CSS reset to account for browser default styling, baseline rules for common elements, basic rules for structural elements, and rules that help with browser inconsistencies.

From there, the framework might include styles for form and table styling, styles to control the site's typography, and a CSS grid for layout. CSS grids allow you to quickly build multi-column layouts based on a specific grid. The grids themselves might be based on a fixed size, a specific aspect ratio, or fluid columns. Basically, they work by having pre-built classes that you can assign to structural elements. Those classes will control the width and layout of containers, making the process of building your layout as simple as applying classes to the containing elements.

Developers will often build CSS grids as part of a larger framework, although it's not uncommon to see them as stand-alone tools. Now the choice to use or not use a CSS framework is entirely up to you or your team. There are both pros and cons to using them, so let's take a look at how to determine if a CSS framework is right for your project. On the plus side, CSS frameworks can save you a lot of work, especially if you're working on a larger site that requires multiple styling options.

They can also take the worry away about generating cross-browser compliant code. In the most cases, this headache will be taken care of for you by the framework. For frameworks that have grids built in, the process of generating layouts is much faster. Many of the grids are designed to be extremely flexible and give you multiple options for creating multi-column layouts. Using a framework in the team environment also gives you a consistent code base to work from, from the beginning. This makes it easier to make sure that everyone's on the same page and that code conventions are already in place.

Basically, if you use them correctly, a quality framework can lower the amount of time that it takes you to create sites and ensure that you're using styles that you know are going to work. That doesn't mean, however, that they're not without their drawbacks. Unless you're working on a really, really complex site, it's doubtful that you'll use all of the features that a framework has to offer. That means that often you have a lot of code in your styles that you're simply not using. Many frameworks also come structured with multiple CSS files.

Now, this means that you either have to combine them yourself or be committed to having links to multiple external style resources on every single page. Another consideration is that most frameworks make heavy use of class styles, and their classes often look something like this. Now, while this means something to the framework, it has no semantic bearing on your site, so if you use a framework, be prepared to have class-heavy, non-semantic markup throughout your site.

Frameworks can also be difficult to update, modify, and maintain. Since you didn't write the code, finding specific styles that you want to modify or overwrite can be a kind of difficult. It can also be hard to add functionality not contained within the framework, as the complex nature of the styles may cause conflicts with your custom styles. Also, just because frameworks are designed to speed up site development, doesn't mean that they're simple to use. The more features a framework has, the more you're going to need to know exactly what's going on in order to make it work efficiently.

In fact, I am going so far as to say that if you're a beginner, a framework isn't necessarily a good idea. You need to understand how the underlying CSS works in order to use them correctly. However, they are great teaching tools. If you find a well-documented CSS framework, learning to use it can be a great way of learning how to write efficient cross-browser CSS. I think one of the best ways is to decide whether a CSS framework is right for you is to simply try one out, so in our next movie I'll introduce you to some of the more popular CSS frameworks to give you a starting point for your own research.

Show transcript

This video is part of

Image for CSS Fundamentals
CSS Fundamentals

36 video lessons · 68467 viewers

James Williamson
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed CSS Fundamentals.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.