#8: CSS Formatting

Being organized and using good formatting in your CSS files can save you lots of time and frustration during your development process and especially during troubleshooting. The multi-line format makes it easy to browse attributes but makes your file vertically very long. The single-line format keeps your file vertically short which is nice for browsing selectors, but it's harder to browse attributes. You can also choose how you want to group your CSS statements. Do you do it by section, like header, content, footer? Or do you do it by types of attributes like typography and layout? Being organized, hierarchical, and using CSS shorthand will go a long way in making you a better CSS coder.

Links from video:


  1. Gerald
    Permalink to comment#

    This is really nice:: Thanks can i get all your screen casts on a CD? that will be appreciated

  2. Mhosis
    Permalink to comment#

    Many thanks ! Your Videos are very helpful. It`s definitely the best CSS Website !

  3. spaceRocker
    Permalink to comment#

    Well, this is going to save me so much time. Thanks!

  4. Andrew
    Permalink to comment#

    This layout seems very similar to that used by the LessCSS (http://lesscss.org). What are your thoughts about using LessCSS for theme development?

  5. Adam Silverman
    Permalink to comment#

    Thanks for posting this. I always get up trying to figure out if I’m doing something the “right” way. It helps to know other folks think about it, and helps to know that I’m on the right track. Appreciate it man!


Leave a Comment

Posting Code

We highly encourage you to post problematic HTML/CSS/JavaScript over on CodePen and include the link in your post. It's much easier to see, understand, and help with when you do that.

Markdown is supported, so you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences like this:

  function example() {
    element.innerHTML = "<div>code</div>";

We have a pretty good* newsletter.