2 Replies - 450 Views - Last Post: 11 August 2012 - 02:01 PM

Poll: Should there be a code organising standard? (4 member(s) have cast votes)

Should there be a code organising standard?

  1. Yes (1 votes [25.00%] - View)

    Percentage of vote: 25.00%

  2. No (2 votes [50.00%] - View)

    Percentage of vote: 50.00%

  3. Depends (1 votes [25.00%] - View)

    Percentage of vote: 25.00%

  4. Maybe (0 votes [0.00%])

    Percentage of vote: 0.00%

  5. What's the point? (0 votes [0.00%])

    Percentage of vote: 0.00%

Vote Guests cannot vote

#1 RafalChmiel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 27-July 12

Is there a code organising standard?

Posted 11 August 2012 - 08:34 AM

I watched Episode 29 of the Doctype video podcast in which they were talking about Organising CSS code. I also noticed that they said there wasn't a standard for it. Is there a code organising standard? Should there be one?
Is This A Good Question/Topic? 0
  • +

Replies To: Is there a code organising standard?

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: Is there a code organising standard?

Posted 11 August 2012 - 10:44 AM

There are a few coding standards out there, but not from any organization like the W3C or WHATWG. Companies and open-source projects just tend to use their own standards for their projects. - I like to stick to the WordPress CSS Coding Standard.

Although, most such standards are pretty much the same. CSS doesn't have that complex syntax, and there aren't that many ways to make large CSS files readable. Basically, it's just: one selector per line; one style per line, indented four spaces or one tab; use spaces between styles and values (and between multiple values); organize the blocks into logical groups, perhaps using comments to separate them.

After that you can go into style order, but that's mostly unnecessary. Few blocks are large enough to warrant that sort of nitpicking.
Was This Post Helpful? 3
  • +
  • -

#3 RafalChmiel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 27-July 12

Re: Is there a code organising standard?

Posted 11 August 2012 - 02:01 PM

View PostAtli, on 11 August 2012 - 10:44 AM, said:

There are a few coding standards out there, but not from any organization like the W3C or WHATWG. Companies and open-source projects just tend to use their own standards for their projects. - I like to stick to the WordPress CSS Coding Standard.

Although, most such standards are pretty much the same. CSS doesn't have that complex syntax, and there aren't that many ways to make large CSS files readable. Basically, it's just: one selector per line; one style per line, indented four spaces or one tab; use spaces between styles and values (and between multiple values); organize the blocks into logical groups, perhaps using comments to separate them.

After that you can go into style order, but that's mostly unnecessary. Few blocks are large enough to warrant that sort of nitpicking.


Thanks for your answer.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1