1.21k likes | 1.37k Views
YUI’s CSS Foundation. Nate Koechley 25 Oct 2007, Yahoo! natek@yahoo-inc.com http://ue.corp.yahoo.com/natek/yui-css. Welcome. Yahoo! User Interface (YUI). Documentation developer.yahoo.com/yui Mailing list groups.yahoo.com/group/ydn-javascript Blog yuiblog.com Nate Koechley
E N D
YUI’s CSS Foundation Nate Koechley 25 Oct 2007, Yahoo! natek@yahoo-inc.com http://ue.corp.yahoo.com/natek/yui-css
Yahoo! User Interface (YUI) • Documentation • developer.yahoo.com/yui • Mailing list • groups.yahoo.com/group/ydn-javascript • Blog • yuiblog.com • Nate Koechley • natek@yahoo-inc.com
HTML CSS JavaScript
HTML CSS JavaScript
CSS is different.Property values from anywhere and everywhere mingle and conflate before a final value is calculated.
CSS is accretive. • Rule #1 Computed Style Rule #2
Two primary layering models • The Cascade sorting rules: • Rules are sorted according to weight and origin. • The Inheritance of computed values: • Some properties are passed to descendent nodes, some of which can accept them. • (Tricky when values repeat, like "80%")
The Cascade Rule #1 Computed Style Rule #2
Inheritance Parent node Child node Grandchild Rule #1
Errors and discrepancies are transferred equally efficiently.
Goals of YUI CSS • Normalize differences • Provide stability • Centrally manage complexity • Solve recurring problems
YUI CSS Components • Reset – a clean foundation • Fonts – typographical control • Grids – layout and page control • Base – basic helper/snippets lib
Foundation Reset Fonts Grids Helpers Base “Base” is an outsider
Grids • Fonts • Reset
Including YUI CSS • Recommended: • Use <link> • Use http://yui.yahooapis.com • Concatenate with your own CSS • More info: • http://developer.yahoo.com/performance/
Including Reset.css • http://yui.yahooapis.com/ • 2.3.1/ • build/ • reset/reset-min.css
Including Fonts.css • http://yui.yahooapis.com/ • 2.3.1/ • build/ • fonts/fonts-min.css
Including Grids.css • http://yui.yahooapis.com/ • 2.3.1/ • build/ • grids/grids-min.css
Pre-Concatenated Version • http://yui.yahooapis.com/ • 2.3.1/ • build/ • reset-fonts-grids/ • reset-fonts-grids.css • (concatenated files are "min" by definition)
Using YUI Grids Control overall page width and centering. Six preset templates that accommodate all IAB ad unit sizes and the vast majority of Y! pages. Easily create nested multi-column regions.
Using YUI Grids Control overall page width and centering. Six preset templates that accommodate all IAB ad unit sizes and the vast majority of Y! pages. Easily create nested multi-column regions.
Part I: Overall Page Width • 750px centered • 950px centered • 974px centered • 100% fluid
The root node • <body> • <div></div> • </body>
What are DIVs for? • "The DIV element, in conjunction with id and class attributes, offers a generic mechanism for adding structure to documents."
The root node • <body> • <div></div> • </body>
Available ID values • 750px centered #doc • 950px centered #doc2 • 974px centered #doc4 • 100% fluid #doc3
750px centered document • <body> • <div id="doc"></div> • </body>
950px centered document • <body> • <div id="doc2"></div> • </body>
974px centered document • <body> • <div id="doc4"></div> • </body>
100% fluid document • <body> • <div id="doc3"></div> • </body>
Notes: • Page width, defined in EMs, allows the page to expand when users zoom their fonts. It’s easy to lock it if you must. • div#doc can hold anything. • Centering is—amazingly—still non-trivial across the range of A-Grade browsers.
Locking the page width • Fluid by default: • #doc2 { • width:73.074em;*width:71.313em; • } • Easy to lock with local override: • #doc2 { • width:950px; • }
Notes: • Page width, defined in EMs, allows the page to expand when users zoom their fonts. It’s easy to lock it if you must. • div#doc can hold anything. • Centering is—amazingly—still non-trivial across the range of A-Grade browsers.
#doc can hold anything • <body> • <div id="doc"> • <div id=“hd”></div> • <div id=“bd”></div> • <div id=“fd”></div> • </div> • </body>
Notes: • Page width, defined in EMs, allows the page to expand when users zoom their fonts. It’s easy to lock it if you must. • div#doc can hold anything. • Centering is—amazingly—still non-trivial across the range of A-Grade browsers.