YUI 3: CSS Base

CSS Base is an optional CSS file that complements YUI's core CSS foundation (CSS Reset and CSS Fonts). CSS Base applies a style foundation for HTML elements that is consistent for A-grade browsers.

CSS Base may also be useful as a template for your own base file, or a snippets library for styling HTML elements.

Getting Started

Include Dependencies

To use CSS Base, include the following source file in your web page:

Global vs. Contextual

YUI's CSS resources apply rules to HTML elements directly (using type selectors). An alternate version of the resource is available that target elements by context only. This contextual -context.css version selects HTML elements only when they descend from the .yui-base classname.

Here is how to include the contextual version of CSS Base:

The YUI CSS Foundation

Note: If you are using the entire YUI CSS foundation, including CSS Reset, CSS Fonts, and CSS Grids resources, we have provided a concatenated and minified aggregate file for you to use use. Using the single "reset-fonts-grids.css" file is better for performance than using each of the foundation files separately.

See the Code

Here are the contents of CSS Base.

Using CSS Base

CSS Base is easy to use. Simply including the file provides consistent styling of HTML elements. Here's an example of HTML elements with CSS Base applied.

Using CSS Base In Specific Contexts

If you're using the contextual version, CSS Base's rules are only applied to elements that descend from a node with a class value of .yui-base. The classname can go as high in the DOM tree as desired, including on the <HTML&ht; element directly.

The following code snippet show how you might apply CSS Base to one of two columns:

Here is another example showing how to apply CSS Base to a subset of a page.

-->

Support & Community

Forums & Blog

YUI 3 discussion forums are hosted on YUILibrary.com.

In addition, please visit the YUIBlog for updates and articles about the YUI Library written by the library's developers.

Filing Bugs & Feature Requests

The YUI Library's public bug tracking and feature request repositories are located on the YUILibrary.com site. Before filing new feature requests or bug reports, please review our reporting guidelines.

Copyright © 2009 Yahoo! Inc. All rights reserved. Copyright | Privacy Policy | Terms of Use | Job Openings