Book Image

MooTools 1.2 Beginner's Guide

Book Image

MooTools 1.2 Beginner's Guide

Overview of this book

MooTools is a simple-to-use JavaScript library, ideal for people with basic JavaScript skills who want to elevate their web applications to a superior level. If you're a newcomer to MooTools looking to build dynamic, rich, and user-interactive web site applications this beginner's guide with its easy-to-follow step-by-step instructions is all you need to rapidly get to grips with MooTools.
Table of Contents (14 chapters)
MooTools 1.2 Beginner's Guide
Credits
About the Authors
About the Reviewer
Preface

MooTools and CSS selectors


MooTools selects an element (or a set of elements) in the DOM using CSS selectors syntax.

Just a quick refresher on CSS terminology; a CSS style rule consists of:

selector {
property: property value;
}
  • selector—indicates what elements will be affected by the style rule

  • property—refers to the CSS property (also referred to as attribute). For example, color is a CSS property, so is font-style. You can have multiple property declarations in one style rule.

  • property value—the value you want assigned to the property. For example, bold is a possible CSS property value of the font-weight CSS property.

For example, if you wanted to select a paragraph element with an ID of awesomeParagraph to give it a red color (in hexadecimal, this is #ff0), in CSS syntax you'd write:

#awesomeParagraph {
color: #ff0;
}

Also, if I wanted to increase its specificity and make sure that only paragraph elements having an ID of awesomeParagraph are selected:

p#awesomeParagraph {
color:...