asvela asvela - 1 year ago 65
HTML Question

Table showed different in IE from Opera

I have a table with a code like this:

<table cellpadding="6" rules="groups" frame="no">

<tr><td>31. January1</td><td>28 km</td><td>3 hours</tr>

The problem is that in IE the table has frame and a tableborder = 1.
What to do?

Answer Source

Try this:

<!DOCTYPE html>
    <title>Example:Table with Header Underline Border</title>
    <style type="text/css">
            border-collapse: collapse;

        table.groups thead th
            border-bottom: solid 1px black;

        table.groups th,
        table.groups td
            padding: 6px;
    <table class="groups">
            <tr><td>31. January1</td><td>28 km</td><td>3 hours</td></tr>

A couple of specific things to note:

  • Using a DOCTYPE to prevent quirks mode.
    (this is the HTML5 DOCTYPE - some people prefer the more wordy XHTML or HTML4 Strict ones - those also work)
  • No unnecessary attributes on the tags - all controlled by tag names and classes.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download