April 20, 2007

Opacity, Jagged Edges, and Header Tags in IE

screwed up textI discovered a bug in IE today. If:

  1. You have headers (as in <h1>, <h2>, <h3>, etc) and…
  2. That header appears above another transparent area and…
  3. That headers has any transparency effects itself then…
  4. You get jagged edges

This is compounded by the fact that the area I was dealing with was a white box on top of the transparent text, so by all means the area “behind” the headers weren’t transparent. See screen shot to the right.

This is retarded. I have a simple fix for this problem. Simply add this to your CSS code:

  1. /*
  2.  * this is a necessary work around for transparency to work with h tags. 
  3.  */
  4. .container h1, .container h2, .container h3, .container h4, .container h5, .container h6 {
  5.     background-color: white; // or whatever color you are working with
  6. }

Replace “container” with whatever area you need to fix.

This is only a problem in IE; Firefox handles things just fine.

Filed under: Random Code — Michi @ 2:59 pm

Share this

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Reddit
  • StumbleUpon
  • del.icio.us
  • description
  • Technorati
  • Slashdot
  • co.mments
  • NewsVine

Related

For the next 10 days, I will try to post every day. Each day, I will post something new I learned that day. It can pertain to any subject. Here we go. Today, I learned about the tfoot HTML tag....
If you've ever tried to stream a PDF file in PHP, you know how incredibly annoying it is to get it working across all browsers. In fact, the maintainer of HtmlToPdf didn't have an official response on the topic...

No Comments »

TrackBack URI | Blog RSS | Comment RSS

No comments yet.

What do you think?