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 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

I've been working on a project where I have been using LinqToSQL that involved
G'day, I have been involved in a project that has required my becoming familiar
Assuming you have been involved in an open source project (GPL'ed) that has been
I have been given a new project module which involves fuzzy logic. It is
I have been developing a project and in this project i have designed my
I came to a new project which have been developed for a quite long
I need some help with a work project I have been assigned. At the
I have a django project that I have been working on as a solo
I have a project on github that I have been working on before. However,
I have a console project that I have been working on. I added log4net

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.