Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS coding style [closed]

Tags:

Are there any good CSS coding style/standards?

like image 285
Sabya Avatar asked Jan 09 '09 13:01

Sabya


People also ask

How do I open style in CSS?

CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.

What are the CSS standards?

CSS standards ensure a Consistent application of style to a project making maintenance easier and minimizing style conflicts. Just as the information on a web page is semantically described in the HTML Markup, CSS describes presentation aspects of the page via a description of its desired visual properties.

Which is the vaild CSS syntax?

The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon.

What is declaration block in CSS?

A CSS declaration block is an ordered collection of CSS properties and values. It is represented in the DOM as a CSSStyleDeclaration . Each property and value pairing is known as a CSS declaration. The CSS declaration block has the following associated properties: computed flag.


2 Answers

Here is a good one:

http://www.phpied.com/css-coding-conventions/

But the important thing is to pick something and stick with it for consistency.

like image 140
Andrew Hare Avatar answered Oct 01 '22 01:10

Andrew Hare


I agree with most of the points at Andrew Hare's link, but I strongly believe

.class-name {     color: green; } 

is inferior to:

.class-name {     color: green; } 

on the grounds that:

.class-name, .class-name2 {     color: green; } 

or:

.class-name,  .class-name2 {     color: green; } 

are considerably less obvious to grep or read than:

.class-name,  .class-name2  {     color: green; } 
like image 33
annakata Avatar answered Oct 01 '22 01:10

annakata