CSS Helper Classes

Entourage now adds a number of CSS classes to the BODY tag based on the end user’s browser environment.

Browser Classes

Browser classes are useful for when you need to create CSS styles that are specific to a particular browser version (e.g., IE6) or a class of browser (e.g., msie).

Here is a list of browser classes added by Appcelerator:

Here’s an example of how you can create a CSS definition for a specific browser.

body.ie6 .myclass
{
	top:5px
}

The class extension above to .myclass will only take effect in IE6.

If you wanted to apply an extension to all versions of IE, you could do the following:

body.msie .myclass
{
	top:5px;
}

Platform Classes

Platform classes identify the operating system of the browser. Here’s a list of the platform classes added by Appcelerator:

These classes can be used just like the browser classes. For example:

body.win32 .myclass
{
	width:200px;
}

Screen Dimension Classes

Screen dimension classes identify the height and width of the user’s browser window. These classes can be used to dynamically alter things like font-size based on the user’s screen dimensions. Here’s a list of the classes added by Appcelerator:

These classes can also be used just like the browser classes. For example, we can alter our the font size for all paragraph tags based on the user’s screen dimensions.

body.height_large p
{
	font-size:200%;
}