wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes CSS Naming Conventions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "CSS Naming Conventions" Watch "CSS Naming Conventions" New topic
Author

CSS Naming Conventions

William Keydel
Greenhorn

Joined: Aug 31, 2006
Posts: 1
Does your book provide any suggestions on naming conventions and organization of the .css document(s)? I find that I struggle to remember the class names and to create good names because I haven't come across suggestions for good naming conventions.
Mike Bowers
Author
Ranch Hand

Joined: Oct 08, 2007
Posts: 42
Does your book provide any suggestions on naming conventions and organization of the .css document(s)?

Yes it does. Chapters 1 and 2 of Pro CSS and HTML Design Patterns have several sections that address this topic.

You can see examples of these items at the book's website http://cssdesignpatterns.com

Chapter 1 discusses the pros and cons of using separate .css files. On the positive side, multiple external .css files make it very easy to modify an entire web site, parts of a web site, or even a single page of a web site. On the other hand, each .css file you add to a web page delays the downloading of the page by 0.1 to 0.5 seconds per file � even if the file has been cached by the browser (a browser still has to ask the server if a cached file has been modified and needs to be downloaded again).

Chapter 2 shows how to reference external .css files and suggests naming conventions and a strategy for loading multiple .css file for different purposes. Chapter 2 also shows how to conditionally load external .css files. This is particularly useful for Internet Explorer 6 and 7, which sometimes requires different CSS settings to work properly. Examples from my book are at the following two links:
http://www.cssdesignpatterns.com/Chapter%2002%20-%20HTML/Header%20Elements/example.html and
http://www.cssdesignpatterns.com/Chapter%2002%20-%20HTML/Conditional%20Stylesheet/example.html

By the way, if you are a developer, you'll love this book because it is all about the best practices for coding XHTML and CSS. I wrote this book because I'm a developer and couldn't find any good CSS books for developers � they were all for designers. I have included a wealth of information on coding XHTML and CSS. The book also has a wealth of information on design patterns that you can quickly use in your code to create cross-browser compliant solutions.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: CSS Naming Conventions
 
Similar Threads
grammar help: what is this structure?
AnyJ
A silly question about naming convention
mysterious problems with java.util.Calendar
Getting MP3's to play in JAVA...