CSS: Multiple Lines or Single Lines?

Over at Ordered List, there’s an entry about writing CSS selectors on single lines, instead of on multiple lines. There’s also a lot of comments from others discussing what they like. I like the whole single line idea, but it looks really messy. I like having everything appear organized. I also add comments so I can see what everything does, without having to try to remember later.

Example of multiple lines:

.link-title {
    color: #777;
    line-height: 1.3em;
    margin-bottom: 8px;
    padding-left: 45px;
    }

Example of single lines:

.link-title {color: #777; line-height: 1.3em; margin-bottom: 8px; padding-left: 45px;}

Before anyone says anything, I did try it on single lines. I really don’t like it. Single lines can be great if you have a very large amount of selectors, (and I do) but it doesn’t have that organized appearance.

Another reason why I don’t want to use single lines is that I would have to go through over 2,000 lines in my CSS file just to change it over to single lines. That is more work than I want to do.

Leave a Reply

Comments will be sent to the moderation queue.