HTML and CSS Reference
In-Depth Information
■ ■ ■
Hacks and Workarounds
H acks are like the significant other you've broken up with, but keep going back to on those
cold, lonely nights because you just can't live without them. You want to forget about them, to
never call or see them again, to just move on , but they continue to haunt your dreams. OK, so
maybe that's just our point of view after spending countless hours over the years searching for
and applying various hacks in the late stages of projects, fighting to keep designs looking exactly
the way we intended in all current browser versions on all platforms.
The point is this: if you're developing sites using CSS for positioning, it's likely you have
already come across (and been frustrated by) some of these odd and sometimes-unexplainable
behaviors exhibited by some browsers. It's an unfortunate reality, brought about in large part
by the poor standards compliance in IE/Win (as discussed in Chapter 4), but a reality we must
deal with nonetheless.
In this chapter, we'll examine the correct methods for using hacks during development to
help you avoid common problems. We'll also discuss best practices for keeping hacks organized
and out of the way, review the hacks that are handy to have around just in case—including the
Star HTML and “Holly” hacks (for IE versions prior to 7), a quick approach to horizontal cen-
tering, easy float clearing (for all browsers!), and filters to help you avoid older browsers. In
addition, we've included some notes about changes in IE 7 that will affect your hacks, and
what you can do to avoid any negative effects. While we're at it, we'll show you how to make
a nice apple crumble for dessert. OK, we lied about that last part. Let's move on . . .
Note Though the term hackis used in this chapter, workaroundis equally interchangeable. Anything that
involves nonstandard uses of CSS or markup (or a combination thereof) in essence equals a “hack” no mat-
ter how you slice it. From Wikipedia: In modern computerprogramming,a“hack”can refer to asolution or
method which functions correctly but which is “ugly”in its concept,which works outside the accepted
structures and norms of the environment,or which is not easily extendable or maintainable ( http:// ).
Search WWH ::

Custom Search