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

  • Home
  • SEARCH
  • 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 98967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:17:51+00:00 2026-05-11T00:17:51+00:00

In a project have been involved in I needed to render tables with columns

  • 0

In a project have been involved in I needed to render tables with columns of a specific width with only one HTML line per table row (no wrapping). I need each table cell to have a padding of 1 pixel at the top and bottom and 2 pixels at the left and right. The best way I can come up with that works cross browser is to put a div inside a td inside the table in this way:

<style>   table.grid { border: none; border-collapse: collapse; }   table.grid tbody tr td { padding: 1px 2px; }   table.grid tbody tr td div { overflow: hidden; white-space: nowrap; }   table.grid tbody tr td.one { width: 100px; }   table.grid tbody tr td.two { width: 200px; } </style> <table class='grid'>   <tbody>     <tr>       <td class='one'><div>One</div></td>       <td class='two'><div>Two</div></td>     </tr>     <tr>       <td class='one'><div>Another One</div></td>       <td class='two'><div>Another Two</div></td>     </tr>   </tbody> </table> 

I would love to be able to eliminate the need to add the extra div. I’ve spend many hours googling this issue but can’t find an alternative.

Is there a way to do what I need without the need to add the extra div? If So, what is it?

Is there a way of getting the desired result without using tables at all?

  • 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. 2026-05-11T00:17:52+00:00Added an answer on May 11, 2026 at 12:17 am

    Unfortunately table elements do not respect overflow, so you will need to apply that to a child element.

    edit: I may have spoken too soon, as I can create this effect in FF using max-width and I’ve discovered this thing which might work for IE. You learn something every day.

    edit2: yeah it does work for IE7 at least but there’s a serious caveat that you can’t have whitespace in the text, they have to be converted to &nbsp;. I think you should probably stick with the <div> solution for sake of cleanliness and compatability.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

G'day, I have been involved in a project that has required my becoming familiar
I have been involved in a lot of projects, both old and new, and
On a recent project I have been working on in C#/ASP.NET I have some
I am about to start a web project and have been working almost exclusively
I found a bunch of scripts in the project I have been newly assigned
I have a project that I have been working on for a while, just
I have been working on a project that has 2 interfaces - windows forms
I have been working on a Java project for a class for a while
I have been looking into the Castle project and specifically Windsor. I have been
I have been assigned a project to develop a set of classes that act

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.