Reputation: 68680
/* Style 1 */
.myclass {
background:#ff0;
border:1px solid #ff0
}
#myid {
width:80px;
height:80px;
}
/* Style 2 */
.myclass { background:#ff0; border:1px solid #ff0 }
#myid { width:80px; height:80px; }
I'm sure there must be more styles for writing CSS, I'd like to know what are they. Is there an article already written that lists all styles.
Thanks
Upvotes: 1
Views: 267
Reputation: 109
My answer will be more than you want, because I've seen a css files that was 60K long and consisted mostly of classes and ID's overwriting others - because no one knows how css works. They just keep adding things until they get the result they want.
.myClass { /* 0,0,1,0 */
top-margin: 1px;
padding: 3px;
}
#myid { /* 0,1,0,0 */
width: 80px;
height: 80px;
}
Repeat with space in between.
Now the important stuff.
.table
. If you need a new table class at www.example.com/foo/... it should be
named something like .foo-table
and should apply and be used by thingsI'm the only one I know that does it this way, but everyone who has used it since has said, "Damn, that makes it easy to find my CSS errors!"
Upvotes: 1
Reputation: 1299
Here is a good list and discussion:
http://css-tricks.com/different-ways-to-format-css/
Upvotes: 4
Reputation: 3707
Ok. I don't know if there is any article discuss about this. But for me style 1 is better in term of readability and debugging.
just my 2 cent
Upvotes: 0