Universal Selectors


Universal selectors are used to select any element. For example, to set the margins and padding on every element to 0, * can be used as shown in Listing 3.9.

Listing 3.9. CSS Code Containing the Universal Selector
* {      margin: 0;      padding: 0; } 

Universal selectors also can be used to select all elements within another element as shown in Listing 3.10. This will select any element inside the <p> element.

Listing 3.10. CSS Code Containing the Universal Selector Within the <p> Element
p * {      color: red; } 




Sams Teach Yourself CSS in 10 Minutes
Sams Teach Yourself CSS in 10 Minutes
ISBN: 0672327457
EAN: 2147483647
Year: 2005
Pages: 234
Authors: Russ Weakley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net