CSS – 5 Tips To Organize A Style Sheet

Print Article Print Article

CSS – 5 Tips To Organize A Style Sheet

By Web Hosting Help Guy

When designing a complicated, large-scale website or any website even, an important factor to keep in mind is how to keep your files organized. I mean, why make any process more difficult than it should be just by not arranging items to make them easily accessible?

Lets take into account designing a website using Cascading Style Sheets (CSS). With the main purpose of CSS being a way of separating document content from document presentation, it’s already meant to be a step taken to organize and simplify HTML coding. Now, with that in mind, why not complete the process by organizing your style sheets to help make them easy to understand, making the maintenance of your website a much easier task. But, as far as which is the best way of organizing a style sheet, it really all comes down to a matter of preference.

CSS Image

Here are basic guidelines to get you started:


Divide Into Specific Sections Using Flags
This helps to identify sections to get to them more quickly. Make sure to first plan out what the specific sections will be. For example:


  • Global Styles – This section can define background, link color, image related things, etc.

  • Typography – This section can define font size, header tags, paragraph tags, etc.

  • Library Styles – This section can define classes for pages that have recurring style elements on various parts of your site.

  • Templates – This section can define your main template layout.

  • Individual Page Structures – This section can define classes for individual pages that do not particularly follow the uniform style of the other pages on your site.

Organized CSS Code Screencap



Create A Table Of Contents
Creating a table of contents creates an easy overview of the stylesheet and adding number references to your code is very helpful for finding sections faster.



Alphabetize Your Properties
This is another way of making specific properties faster to locate.



Indent Descendant/Child Items & Related Rules
This helps to visually define page areas and how they’re related.



CSS Organizer Web Apps
Tools such as StyleNeat or ProCSSor can help to visually organize and standardize your CSS.


What other methods have you used to organize a stylesheet?

Comments

Lucian January 23rd, 2011 at 10:54 am

When i start to build the CSS i don’t think ahead to the structure, and i often end up with a bad written css code where is hard to find something.

I will try to follow the guidelines and to write better css code.

Assistance with September 19th, 2011 at 2:50 pm

Guidance with…

[...]CSS – 5 Tips To Organize A Style Sheet | Web Hosting Help Guy[...]…

Leave A Comment

Name *required

Email *not published *required

Website