Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
YUI 2.8: Learning the Library
YUI 2.8: Learning the Library

YUI 2.8: Learning the Library: Develop your next-generation web applications with the YUI JavaScript development library

eBook
€25.99 €28.99
Paperback
€37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

YUI 2.8: Learning the Library

Chapter 2. Creating Consistency with the CSS Tools

Not only does the library provide you with a rich selection of easily implemented utilities and UI controls that save you time and effort when developing and debugging, but it is also a gift that keeps on giving with a selection of CSS Tools that every developer should have to hand.

The CSS Tools of the library are separate from the CSS files required by some of the controls in order to be displayed correctly; some of the controls contain a folder within their unpacked directories called assets, and in this folder there may be images, a stylesheet, or sometimes both depending on the control. The CSS files discussed in this chapter are separate, autonomous components of the library, and are on a level with both the utilities and controls.

In this chapter we're going to examine these tools in detail and learn exactly what they can do for your web pages and applications, if used in conjunction with other components of the library, or completely...

Tools of the trade


There are some similarities between the CSS Tools and the other components of the library and there are of course some differences. Like each of the other components, there is also a full version of each file with comments and whitespace preserved for readability, and a minified production version.

If you wish, you can also have Yahoo! serve the CSS files used by the tools to you across the Internet by linking to the files held on their servers, just as you can with the other library components.

Several different configurations of the CSS Tools have also been put together, which combine some of the different tools into single files, making them easier and more efficient to use together. reset.css and fonts.css have been aggregated into one file for your convenience, which is probably because the YUI team recommend the use of these two tools in all YUI implementations. A reset-fonts-grids.css file has also been created due to the high likelihood that the huge range of page...

Element normalization with reset.css


Often, one of the most painful exercises in web development is simply getting everything to look consistent across the major browser platforms. No standard states how a particular HTML element should look. The intent of a markup might be self-evident; we would expect an <h1> to look larger or bolder than an <h2>, and both larger than plain text but there is no standard saying by how much. Developers will often design and test an implementation in one particular browser, and then when everything is working and rendering correctly in their browser of choice, they will have to refine it and tweak it until it works and renders similarly in all of the other major browsers.

Due to the differences between the default stylesheet in use in the various browsers, getting pages to render in the same way can be a challenge. Something that lines up perfectly in IE will undoubtedly be misaligned in other browsers. And of course, when you correct the differences...

First base


Where the reset.css tool breaks down the default stylesheets of the different browsers, the base.css tool then builds upon this level foundation to provide basic styling across a range of commonly used elements.

There are certain elements on your page that just should be styled differently from other elements. Heading text for example, simply should stand out from body text; that's the whole point of heading text in the first place.

So the Base CSS Tool reintroduces some of the presentational styles of the common elements that the Reset CSS Tool neutralizes, but it does so in a way that is consistent across browsers. Italics and boldface are restored to those elements where you would expect them.

Headings are all made bold and given increasing sizes that can be rendered reliably in all browsers. Those sizes are expressed in relative (percentage) units so the headings will scale correctly if the user zooms in. Space is provided both above and below each heading and also after paragraphs...

Tidying up text with fonts.css


The next CSS Tool, fonts.css, is provided so that you can easily standardize all of your text to a single font-face, font-size, and line-height. In terms of the amount of actual code, this file is tiny; in fact much smaller than the Reset CSS Tool we looked at earlier, providing just five rules in total.

It standardizes all rendered text on the page to the Arial font, except for text within <pre> and <code> tags, which instead use the monospace typeface.

The first rule targets the <body> tag and sets the font-family attribute to arial, helvetica, clean, or sans-serif. This provides a clear font degradation path; if browsers or operating systems don't have Arial installed or for some reason can't display it, the platform tries Helvetica next, and so on, right down to sans-serif if necessary (although it's unlikely that the browser would need to travel all the way down to the end of the degradation path).

This is also important for Unicode...

Layout pages with ease using grids.css


Experience has shown that certain layouts tend to work better than others. The Interactive Advertising Bureau (IAB), that tries to standardize ads displayed on the Web, regularly publishes guidelines for their size. As screen resolutions increase, we can make use of more screen real estate, but we still have to support older, narrower displays so it is better if we stick to narrower, more conservative sizes. grids.css allows us to easily arrange the components in a page in several of the most common layouts or combine them to build our own.

In comparison to the other three CSS Tools, the grids.css file is a lot bigger, containing a much wider range of selectors and rules. This tool is used in a different way than the other two; instead of just linking to the file and forgetting about it, you will need to make use of specific class names, give element-specific IDs, and use the correct nesting structures in order to have your pages laid out in the format...

A word on Sam


Completely separate from the CSS Tools, but still composed entirely of CSS, the Sam skin provides a default theme for each of the library's controls. Each control contains a skin CSS file in its assets folder and should be linked to using the standard <link> tag in the <head> of any pages on which the controls are displayed.

In order to use the skin files, as well as linking to the stylesheet used by the skin, you will also need to give the containing element (whether that is the <body> or a <div>) a special class name:

<body class="yui-skin-sam">

Or, for finer control:

<div class="yui-skin-sam">
<div id="someControl"></div>
</div>

This makes using the skin extremely easy. The Sam skin takes its name from its creator Sam Lind. At its launch, it was expected that developers would contribute further skins but that has not yet happened as each site develops the skins for the components it uses instead of a whole set for all...

Summary


The CSS Tools are the smallest and without doubt the easiest component of the library to use, but their contribution in the form of time-saving and functionality provided is no less than that of the utilities and controls.

First the Reset CSS Tool provides normalization services to the most common HTML elements so that borders, margins, and padding, among other things, are set to zero across all of the most common browsers.

The Base CSS Tool then builds upon the level foundation provided by Resets to give certain elements back some of the styling that marks them out from other elements. This tool is the only one that isn't part of the minified aggregated resets-fonts-grids.css file.

Next, all of your page text is standardized to the Arial font and is given a fixed line height. Sizes are also fixed to a consistent size across the document with the Fonts CSS Tool.

Finally, the precise layout of your page can be declared through the use of a range of CSS classes, IDs, and templates defined...

Left arrow icon Right arrow icon

Key benefits

  • Improve your coding and productivity with the YUI Library
  • Gain a thorough understanding of the YUI tools
  • Learn from detailed examples for common tasks

Description

The YUI Library is a set of utilities and controls written in JavaScript for building Rich Internet Applications, across all major browsers and independently of any server technology. There's a lot of functionality baked into YUI, but getting to and understanding that functionality is not for the faint of heart. This book gives you a clear picture of YUI through a step-by-step approach, packed with lots of examples.YUI 2.8: Learning the Library covers all released (non-beta) components of the YUI 2.8 Library in detail with plenty of working examples, looking at the classes that make up each component and the properties and methods that can be used. It includes a series of practical examples to reinforce how each component should/can be used, showing its use to create complex, fully featured, cross-browser, Web 2.0 user interfaces. It has been updated from its first edition with the addition of several chapters covering several new controls and enriched with lots of experience of using them.You will learn to create a number of powerful JavaScript controls that can be used straightaway in your own applications. Besides giving you a deep understanding of the YUI library, this book will expand your knowledge of object-oriented JavaScript programming, as well as strengthen your understanding of the DOM and CSS. The final chapter describes many of the tools available to assist you the developer in debugging, maintaining, and ensuring the best quality in your code. In this new edition, all the examples have been updated to use the most recent coding practices and style and new ones added to cover newer components. Since the basic documentation for the library is available online, the focus is on providing insight and experience.The authors take the reader from beginner to advanced-level YUI usage and understanding.

Who is this book for?

This book is for web developers comfortable with JavaScript and CSS, who want to use the YUI library to easily put together rich, responsive web interfaces. No knowledge of the YUI library is presumed.

What you will learn

  • Explore the YUI Library s utilities, controls, core files, and CSS tools
  • Install the library and get up and running with it
  • Handle DOM manipulation and scripting
  • Get inside Event Handling with YUI
  • Create consistent web pages using YUI CSS tools
  • Use rich user interface controls
  • Communicate with external sources of data
  • Debug, maintain, and update applications
  • Examples included in the book:
  • Calendar interface
  • Autocomplete
  • Creating panels
  • Dialogs
  • Custom tooltips
  • Forms
  • Split button
  • TreeView Control
  • Browser History Manager with Calendar
  • Simple and custom animations
  • Creating tabs and adding content dynamically
  • Dragging and dropping
  • Implementing sliders
  • DataTable Control
  • Rich Text Editor
  • Creating Menus
  • Creating custom controls with Element
  • Connecting with web services and other sources
Estimated delivery fee Deliver to Czechia

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 15, 2010
Length: 404 pages
Edition : 1st
Language : English
ISBN-13 : 9781849510707
Vendor :
Yahoo!
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Czechia

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Publication date : Jul 15, 2010
Length: 404 pages
Edition : 1st
Language : English
ISBN-13 : 9781849510707
Vendor :
Yahoo!
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 121.97
YUI 2.8: Learning the Library
€37.99
Python 3 Object Oriented Programming
€41.99
PHP 5 CMS Framework Development - 2nd Edition
€41.99
Total 121.97 Stars icon

Table of Contents

13 Chapters
Getting Started with YUI Chevron down icon Chevron up icon
Creating Consistency with the CSS Tools Chevron down icon Chevron up icon
DOM Manipulation and Event Handling Chevron down icon Chevron up icon
Calling Back Home Chevron down icon Chevron up icon
Animation, the Browser History Manager, and Cookies Chevron down icon Chevron up icon
Content Containers and Tabs Chevron down icon Chevron up icon
Menus Chevron down icon Chevron up icon
Buttons and Trees Chevron down icon Chevron up icon
DataSource and AutoComplete Chevron down icon Chevron up icon
DataTable Chevron down icon Chevron up icon
Rich Text Editor Chevron down icon Chevron up icon
Drag-and-Drop with the YUI Chevron down icon Chevron up icon
Everyday Tools Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(1 Ratings)
5 star 0%
4 star 100%
3 star 0%
2 star 0%
1 star 0%
Brad Harris Sep 04, 2010
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
This book explains the full feature set of the YUI library. The author's do a really great job of showing in depth examples that teach you how the components work. I particularly liked reading the chapter on DataSource and DataTable.If the online examples provided by YAHOO! leave you wondering how things are working, this book fills in those gaps. Most of the book is targeted to beginners and intermediate developers.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela