Mini Slide Navigation from Stephen Clark
CSS
Design Inspiration – Part Three
I keep a list of well designed Web sites to give me a creative nudge when I get designer’s block in the midst of creating a Web site. Different designers handle this frustration in different ways. Some avoid any outside influence, while others, like me, seek out amazing work, searching for a small spark to re-ignite their creativity. There are times when this spark can come from something as simple as the shape of one curve, or the choice of color pallet. You never know. Well, at least I don’t. So, for that reason, here are some sites that I visit for inspiration.
This is the third entry in my design inspiration series, please see parts one, two and four for further inspiration.
Design Inspiration – Part Two
I had planned to expand my list of design inspirations in a more timely fashion, but it appears that I forgot. Seven months have passed without an update. Ahh well, here are some more sites that I visit when I need a creativity nudge. As before, some of these sites are the destination, while others are portals to beautiful work.
- Brother Jones Artworks – No relation… darnit
- Building the High
- Firewheel Design
- Fish Marketing
- hicksdesign
- Media Inspiration
This is the first entry in my design inspiration series, please see parts one, three and four for further inspiration.
Uncollapsing Margins
Eric Meyer has published another great resource for the Web development community: Uncollapsing Margins discusses “how margin collapsing can lead to weird behaviors, why these behaviors arise, and ways to work around it when you want a different result. If you’ve ever tried to figure out why a heading’s top margin seems to disappear when it’s the first thing in a div, this article will be of interest.”
Margin collapsing is one of the most confusing aspects of CSS as it isn’t mentioned very often, and until this article, I hadn’t seen a comprehensive explanation of why it happens, and how to “un-collapse” them. Yes, some people posted work in various forums and lists, but Eric has taken the time to tie everything together.
For anyone unfamiliar with Eric, he is the author of many great CSS books, including:
- Eric Meyer on CSS (I highly recommend this book for new and experienced developers)
- More Eric Meyer on CSS
- Cascading Style Sheets: The Definitive Guide
- Cascading Style Sheets 2.0 Programmer’s Reference
- CSS Pocket Reference
CSS Methodology
I’ve been trading e-mails with a colleague for the last few days and he asked if there are any CSS methodologies available. While I have practices that I consistently follow, I do not know of any that are wide-spread or commonly accepted as the best way to set up and maintain style sheets. So, I sent an e-mail to the CSS-D list to gather the feedback of other designers and developers. Below is the e-mail I sent sans-introduction which you just read.
So, does anyone know of a good methodology already in existence? If not, anyone interested in assisting me as I begin to document and revise one?
In case there aren’t any, here are a some of the practices I follow. Please feel free to let me know of poor decisions in my methods, and suggest new ones!
Style Sheet Organization
- Classes, IDs and elements are listed in alphabetical order unless otherwise noted. The properties of each class, element and ID are in alphabetical order as well. So the “acronym” tag comes before the “body” tag which comes before the “price” ID in the stylesheet. I find this makes it much easier for me and other developers to locate specific items within the stylesheet quickly.
- The link pseudo-classes are grouped together, but do not follow the alphabetical organization within that grouping as some browsers will use the last pseudo-class listed, even if the more accurate one is listed earlier. Rather annoying.
- When possible, elements should be grouped if they have a common attribute, or set of attributes. An example would be to assign the same font to the “body”, “p”, “input” and “td”:
body, input, p, td {
font: small Georgia, Garamond, "Times New Roman", serif;
}
- When possible descendant styles should be used to cut down on the code in the style sheets. Below is an example of applying a specific style to an input element within a form with an element that has been assigned the “Purchase” class. Example:
.Purchase form input {
border: 1px solid #654819;
height: 18px;
}
Style Naming Convention
- Classes and IDs use mixed case to make them easier to read. In the HTML 4.01 spec, classes and IDs are case sensitive; though some browsers do not recognize the fact. Elements are left in lower case. I know this one may end up being controversial as naming conventions often tend to be
- Do not start an ID or class with a digit or use underscores as they may not work in all browsers.
- Classes and IDS should never be an adjective or infer placement as a future redesign may not place the item in the same spot, or use the same background color. So, instead of using an ID of “TopBox”, use an ID specific to its contents, perhaps “GlobalNav”.