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 6564153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:55:53+00:00 2026-05-25T13:55:53+00:00

Apparently a classic problem, but the solutions I’ve found haven’t worked, including various other

  • 0

Apparently a classic problem, but the “solutions” I’ve found haven’t worked, including various other questions on SO.

If my table is wider than its container, I want my table cell width to remain fixed and not be resized to fit the container.

Reproducible HTML (<td>s generated with PHP):

<html>
  <head></head>

  <body>
    <table>
      <tr>
        <?php for($i=0;$i<15;$i++) { 
           echo "<td style='width:150px;border-right:1px solid black;'>".($i+1)."</td>"; 
        } ?>
      </tr>
    </table>
    <div style='background:chartreuse;width:150px'>This is 150px wide.</div>
  </body>
</html>

What I’ve tried:

  • table-layout:fixed
  • span container with display:inline-block set
  • div container with inline block

It seems there should be an easy way to make the previous code generate a table that overflows the body.

Can someone help?

Edit

It may not be clear from my previous wording, but I want to specify column width myself.

I’m trying to do this without specifying an explicit width for the table. Only the TDs will force the table wider, which (should?) force the container wider.

Also, the inline CSS is there for example purposes only.

  • 1 1 Answer
  • 0 Views
  • 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-25T13:55:53+00:00Added an answer on May 25, 2026 at 1:55 pm
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <div style="margin: 0pt auto; width: 980px;">
      <div style="500px;overflow:scroll">
        <table style="width: 100%; table-layout: fixed;">
          <tbody>
            <tr>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
              <td style="width:150px;border-right:1px solid black;">This is 150px wide.</td>
            </tr>
          </tbody>
        </table>
        <div style="background:chartreuse;width:150px">This is 150px wide.</div>
      </div>
    </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apparently many people have run into this problem, but I have yet to be
Apparently xrange is faster but I have no idea why it's faster (and no
Apparently you can easily obtain a client IP address in WCF 3.5 but not
Apparently, I'm missing something fundamental. I'm having a problem with formatting the value of
Classic ASP, VBScript context. A lot of articles including this Microsoft one , say
Apparently I'm missing something obvious here, but would appreciate a quick example. I've got
Apparently this problem comes up fairly often, after reading Regular expression to detect semi-colon
Apparently the font Arvo is supposed to work fine in IE, but I can't
Apparently there's a problem with the nagivateToUrl function in Flex , namely that it
Apparently Linkedin is funny about urlencoding the ~ in https://api.linkedin.com/v1/people/~ my problem is that

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.