Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 442351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:03:48+00:00 2026-05-12T21:03:48+00:00

I have an example of a simple HTML table that contains a number of

  • 0

I have an example of a simple HTML table that contains a number of div blocks.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head></head>
<body>
  <table border=1 width="1000px" >
    <tr><td></td><td></td><td></td><td></td></tr>
    <tr valign="top"><td colspan="1"  ><div style="width:180px;border: solid 1px black;">1</div></td><td colspan="3"  ><div style="width:770px;border: solid 1px black;">2</div></td></tr>
    <tr valign="top"><td colspan="4"  ><div style="width:960px;border: solid 1px black;">3</div></td></tr>
    <tr valign="top"><td colspan="2"  ><div style="width:475px;border: solid 1px black;">4</div></td><td colspan="2"  ><div style="width:475px;border: solid 1px black;">5</div></td></tr>
  </table>
</body>
</html>

The problem is that the look of row 2 is not correct. The colspans are not behaving as expected. If I remove the fourth line then the second behaves correctly.

I am aware that divs and CSS is the way to go but for this application, at this time, this is not possible.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:03:48+00:00Added an answer on May 12, 2026 at 9:03 pm

    Your problem is auto table layout. It’s hard for a browser to look at all the cells and work out how much width each is going to get from their content; it’s double-hard when there are colspans (especially in this example where there’s no way to tell how wide columns 3 and 4 should be at all); and it’s triple-hard when you’re poor old hard-of-thinking Internet Explorer, bless.

    Don’t make your browser struggle, wheeze and render slowly: use fixed table-layout and declare the width of every column exactly. Normally this would be done with <col> elements:

    #thing { width: 950px; table-layout: fixed; border-spacing: 0; }
    #thing .wide { width: 295px; }
    #thing .narrow { width: 180px; }
    #thing.box { border: solid black 1px; }
    
    <table id="thing">
        <col class="narrow" /><col class="wide" /><col class="wide" /><col class="narrow" />
        <tr>
            <td colspan="1"><div class="box">1</div></td>
            <td colspan="3"><div class="box">2</div></td>
        </tr>
        <tr>
            <td colspan="4"><div class="box">3</div></td>
        </tr>
        <tr>
            <td colspan="2"><div class="box">4</div></td>
            <td colspan="2"><div class="box">5</div></td>
        </tr>
    </table>
    

    However there is a bug in Webkit that ignores <col> widths when there is no single unspanned cell in that column. This is quite unusual for tables, but it is the case in the above example: only the first column contains an unspanned cell. To work around it, you can either replace the <col> elements with a dud row at the start, styled to have minimal height:

    #thing .cols td { height: 1px; line-height: 1px; font-size: 1px; }
    
    <tr class="cols">
        <td class="narrow"></td><td class="wide"></td><td class="wide"></td><td class="narrow"></td>
    </tr>
    

    Or, sometimes less intrusive, keep the <col>s and add a dud row at the bottom:

    <tr class="cols"><td></td><td></td><td></td><td></td></tr>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple dynamic html structure of a table that contains links
I have a simple HTML table display of data that results from an MySQL
I have this very simple example that I am using to learn structs in
Like the title says, I want to have a HTML table that allows its
Simple (I hope), HTML question. Let's say I have a column group that spans
I have a website that has an index.php, a few simple .html pages and
I want to make a simple table that contains a custom button in a
I'm trying to build a simple HTML table form that displays values from a
I am designing a very simple table that contains a data element's properties. This
I have a simple table that prints our the list of videos and plays

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.