Internet Explorer 6 and the blank spaces in TD element

Thursday, 5 March 2009 11:15 by myro

Every web designer knows how much Internet Explorer 6 sucks, but i didn't expect this: Internet Explorer renders the html differently if you open and close the TD element on the same line or not. If you write a TD element on more than one line, you will notice blank borders and you won't be able to remove them, unless you rewrite your element on a single line:
HTML table with blank borders:

 <table style="width:100%" cellpadding="0" cellspacing="0">
  <tr>
    <td class="menu">
      <a href="/default.aspx">
        <img src="images/home.gif" alt="Home"/>
      <a>
    <td>
    <td class="menu">
      <a href="/chisiamo.aspx">
        <img src="images/chisiamo.gif" alt="Chi siamo"/>
      <a>
    <td>
    <td class="menu">
      <a href="/NegoziInsegnanti.aspx">
        <img src="images/negozi.gif" alt="Negozie"/>
      <a>
    <td>
    <td class="menu">
      <a href="/Galleria.aspx">
        <img src="images/Galleria.gif" alt="Galleria"/>
      <a>
    <td>
  <tr>
<table>

Same table with the correct rendering in Internet Explorer 6.

<table style="width:100%" cellpadding="0" cellspacing="0">
  <tr>
    <td class="menu"><a href="/default.aspx"><img src="images/home.gif" alt="Home"/><a>td>
    <td class="menu"><a href="/chisiamo.aspx"><img src="images/chisiamo.gif" alt="Chi siamo"/><a>td>
    <td class="menu"><a href="/NegoziInsegnanti.aspx"><img src="images/negozi.gif" alt="Negozi"/><a>td>
    <td class="menu"><a href="/Galleria.aspx"><img src="images/Galleria.gif" alt="Galleria"/><a>td>
  <tr>
<table>

So, if want to create an Internet Explorer 6 compatibile HTML template, remember to write TD tags on a same line.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Developer Life
Actions:   Bookmark and Share | Permalink | Comments (0) | Comment RSSRSS comment feed
If you consider this post usefull for your purposes, please consider visiting my sponsors to help me out with the myrocode.com maintenance. Thank you.