Prev | Current Page 243 | Next

Charles Wyke-Smith

"Stylin' with CSS: A Designer's Guide 2nd Edition"

Because this element has
no name, you reference it with * (known as star), the universal CSS selector,
which effectively means ???any element.??? As an example, a common way to
use the star selector is like this
div * ul {??¦CSS declarations here??¦}
Here, the ul is not selected if it is a child of the div, but it is if it is a grandchild.
You use the * to say that it doesn??™t matter what the in-between child
element is.
(continued on next page)
star hack for IE6 only - IE7 understands
the :?¬? rst-child pseudo class
and ignores the star hack
STYLIN??™ WITH CSS - CHAPTER 6 216
The Star Hack and the Backslash Hack (continued)
So, using this same selector to create a rule that is only read by Internet
Explorer 6, you write
* html ??¦more speci?¬? c selectors??¦ {??¦CSS declarations here??¦}
For example
div#box {border:1px solid blue;}
* html div#box {border:1px solid red;}
In this example, all browsers set the border to blue, except Internet Explorer
6 for Windows and Internet Explorer for Mac, which read the second rule
also and display the box border in red.
However, the more compliant Internet Explorer for Mac can interpret both
the * selector and some CSS that Internet Explorer 6 for Windows cannot
interpret. So you need some way to ensure that only Internet Explorer for
Windows reads the star hack rule. You do this by putting the star hack rule
inside a pair of comments, which are written in a special way to take advantage
of a strange, unique behavior of Internet Explorer for Mac.


Pages:
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255