CSS

Cascading Style Sheets 2 Attribute Selectors

CSS No Comments

With CSS2 we can now use the attributes of elements to help define our styles. Before, the only attribute you could use was the “class” attribute. But now, you match any attribute an element might have to define styles for it. (more…)

Class vs. ID – When to Use Each Selector

CSS No Comments

It is often hard to decide when to use a class versus an id for an element. Here is an easy way to think of the difference:

Use a class tag if:

  1. The style is used in various places throughout the document.
  2. The style is very general.

Use an id tag if:

  1. The style is only used once ever in the document.
  2. The style is specific to a certain area of the document.

Remember that an id can only appear once in any HTML document. Once you’ve used the id, it should not be used again on that page.

Source: About.com

CSS Hacks for IE

CSS No Comments

As I was working on coding a new site for a client I ran into some problems with some margins in IE (Internet Explorer). I figured that this would be a good resource for other coders. You can also apply these to any other CSS attribute.

Regular CSS

#newsletter{margin-top:22px;}

IE6

*html #newsletter{margin-top:35px;}

IE7

*+html #newsletter{margin-top:35px;}

IE8

#newsletter{margin-top /***/:20px;}