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

Ask A Question

Stats

  • Questions 236k
  • Answers 236k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The basic assumption with WCF is that you always call… May 13, 2026 at 6:25 am
  • Editorial Team
    Editorial Team added an answer You could create your own Func delegates, or you could… May 13, 2026 at 6:25 am
  • Editorial Team
    Editorial Team added an answer What are you looking for? Choose the one from the… May 13, 2026 at 6:25 am

Related Questions

I have a cherryPy program that returns a page that has an image (plot)
I am developing a script in my localhst using PHP and mysql and I
I'm looking for a strategy for managing links within articles. The body of the
I would like to make all cells of an HTML table clickable--that is, the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.