YUI recommends YUI3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

This documentation is no longer maintained.

YUI 2: Base CSS

YUI 2: Base CSS

Base is an optional CSS file that complements YUI's core CSS foundation (Reset, Fonts, and Grids). While Reset removes and neutralizes the inconsistent default styling of HTML elements, Base applies a consistent style foundation for common HTML elements across A-grade browsers

Video: The YUI CSS Foundation

In this 42-minute tech talk from October 2007, YUI senior engineer and CSS component author Nate Koechley provides a holistic introduction to this and all of the YUI CSS components. [iPod/iPhone compatible download also available.]

Getting Started

To use Base, include the following source file in your web page with the link element:

  1. <!-- Source File -->
  2. <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/base/base-min.css">
  3.  
<!-- Source File -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/base/base-min.css">
 

The YUI CSS Foundation

Note: Base is offered as a single file, however if you're using it in conjunction with the rest of the core YUI CSS foundation, including the Reset, Fonts, and Grids packages, we have provided a concatenated and minified aggregate file of those three core pieces for you to use. Including the "reset-fonts-grids.css" file will give you more efficient pageload performance as compared to including each of the foundation files separately.

  1. <!-- Source File -->
  2. <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/reset-fonts-grids/reset-fonts-grids.css">
  3. <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/base/base-min.css">
  4.  
<!-- Source File -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/reset-fonts-grids/reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/base/base-min.css">
 

YUI dependency configurator.

YUI Dependency Configurator:

Instead of copying and pasting the filepaths above, try letting the YUI dependency Configurator determine the optimal file list for your desired components; the Configurator uses YUI Loader to write out the full HTML for including the precise files you need for your implementation.

Note: If you wish to include this component via the YUI Loader, its module name is base. (Click here for the full list of module names for YUI Loader.)

Where these files come from: The files included using the text above will be served from Yahoo! servers. JavaScript files are minified, meaning that comments and white space have been removed to make them more efficient to download. To use the full, commented versions or the -debug versions of YUI JavaScript files, please download the library distribution and host the files on your own server.

Order matters: As is the case generally with JavaScript and CSS, order matters; these files should be included in the order specified above. If you include files in the wrong order, errors may result.

See the Code

Here is what's in Base. As you can see in the code below, or in this example showing HTML elements after Base has been applied, it creates a familiar presentation for HTML elements.

  1. /* base.css, part of YUI's CSS Foundation */
  2. h1 {
  3. /*18px via YUI Fonts CSS foundation*/
  4. font-size:138.5%;
  5. }
  6. h2 {
  7. /*16px via YUI Fonts CSS foundation*/
  8. font-size:123.1%;
  9. }
  10. h3 {
  11. /*14px via YUI Fonts CSS foundation*/
  12. font-size:108%;
  13. }
  14. h1,h2,h3 {
  15. /* top & bottom margin based on font size */
  16. margin:1em 0;
  17. }
  18. h1,h2,h3,h4,h5,h6,strong {
  19. /*bringing boldness back to headers and the strong element*/
  20. font-weight:bold;
  21. }
  22. abbr,acronym {
  23. /*indicating to users that more info is available */
  24. border-bottom:1px dotted #000;
  25. cursor:help;
  26. }
  27. em {
  28. /*bringing italics back to the em element*/
  29. font-style:italic;
  30. }
  31. blockquote,ul,ol,dl {
  32. /*giving blockquotes and lists room to breath*/
  33. margin:1em;
  34. }
  35. ol,ul,dl {
  36. /*bringing lists on to the page with breathing room */
  37. margin-left:2em;
  38. }
  39. ol li {
  40. /*giving OL's LIs generated numbers*/
  41. list-style: decimal outside;
  42. }
  43. ul li {
  44. /*giving UL's LIs generated disc markers*/
  45. list-style: disc outside;
  46. }
  47. dl dd {
  48. /*giving UL's LIs generated numbers*/
  49. margin-left:1em;
  50. }
  51. th,td {
  52. /*borders and padding to make the table readable*/
  53. border:1px solid #000;
  54. padding:.5em;
  55. }
  56. th {
  57. /*distinguishing table headers from data cells*/
  58. font-weight:bold;
  59. text-align:center;
  60. }
  61. caption {
  62. /*coordinated marking to match cell's padding*/
  63. margin-bottom:.5em;
  64. /*centered so it doesn't blend in to other content*/
  65. text-align:center;
  66. }
  67. p,fieldset,table {
  68. /*so things don't run into each other*/
  69. margin-bottom:1em;
  70. }
  71.  
/* base.css, part of YUI's CSS Foundation */
h1 {
	/*18px via YUI Fonts CSS foundation*/
	font-size:138.5%;
}
h2 {
	/*16px via YUI Fonts CSS foundation*/
	font-size:123.1%;
}
h3 {
	/*14px via YUI Fonts CSS foundation*/
	font-size:108%;
}
h1,h2,h3 {
	/* top & bottom margin based on font size */
	margin:1em 0;
}
h1,h2,h3,h4,h5,h6,strong {
	/*bringing boldness back to headers and the strong element*/
	font-weight:bold;
}
abbr,acronym {
	/*indicating to users that more info is available */
	border-bottom:1px dotted #000;
	cursor:help;
}
em {
	/*bringing italics back to the em element*/
	font-style:italic;
}
blockquote,ul,ol,dl {
	/*giving blockquotes and lists room to breath*/
	margin:1em;
}
ol,ul,dl {
	/*bringing lists on to the page with breathing room */
	margin-left:2em;
}
ol li {
	/*giving OL's LIs generated numbers*/
	list-style: decimal outside;
}
ul li {
	/*giving UL's LIs generated disc markers*/
	list-style: disc outside;
}
dl dd {
	/*giving UL's LIs generated numbers*/
	margin-left:1em;
}
th,td {
	/*borders and padding to make the table readable*/
	border:1px solid #000;
	padding:.5em;
}
th {
	/*distinguishing table headers from data cells*/
	font-weight:bold;
	text-align:center;
}
caption {
	/*coordinated marking to match cell's padding*/
	margin-bottom:.5em;
	/*centered so it doesn't blend in to other content*/
	text-align:center;
}
p,fieldset,table {
	/*so things don't run into each other*/
	margin-bottom:1em;
}
 

Support & Community

The YUI Library and related topics are discussed on the on the YUILibrary.com forums.

Also be sure to check out 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 © 2013 Yahoo! Inc. All rights reserved.

Privacy Policy - Copyright Policy - Job Openings