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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:58:36+00:00 2026-05-10T22:58:36+00:00

Does anyone know how I can prevent the text in a table cell from

  • 0

Does anyone know how I can prevent the text in a table cell from wrapping? This is for the header of a table, and the heading is a lot longer than the data under it, but I need it to display on only one line. It is okay if the column is very wide.

The HTML of my (simplified) table looks like this:

<table>   <thead>     <tr>       <th>         <div>Really long column heading</div>       </th>       <th>         <div>Really long column heading</div>       </th>       <th>         <div>Really long column heading</div>       </th>       <th>         <div>Really long column heading</div>       </th>       <th>         <div>Really long column heading</div>       </th>       <th>         <div>Really long column heading</div>       </th>       <th>         <div>Really long column heading</div>       </th>     </tr>   </thead>   <tbody>     <tr>       <td>         <div>data</div>       </td>       <td>         <div>data</div>       </td>       <td>         <div>data</div>       </td>       <td>         <div>data</div>       </td>       <td>         <div>data</div>       </td>       <td>         <div>data</div>       </td>       <td>         <div>data</div>       </td>     </tr>   </tbody> </table> 

The heading itself is wrapped in a div inside the th tag for reasons pertaining to the javascript on the page.

The table is coming out with the headings wrapping onto multiple lines. This seems to only happen when the table is sufficiently wide, as the browser is trying to avoid horizontal scrolling. In my case, though, I want horizontal scrolling.

Any ideas?

  • 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-10T22:58:36+00:00Added an answer on May 10, 2026 at 10:58 pm

    Have a look at the white-space property, used like this:

    th {     white-space: nowrap; } 

    This will force the contents of <th> to display on one line.

    From linked page, here are the various options for white-space:

    normal
    This value directs user agents to collapse sequences of white space, and break lines as necessary to fill line boxes.

    pre
    This value prevents user agents from collapsing sequences of white space. Lines are only broken at preserved newline characters.

    nowrap
    This value collapses white space as for ‘normal’, but suppresses line breaks within text.

    pre-wrap
    This value prevents user agents from collapsing sequences of white space. Lines are broken at preserved newline characters, and as necessary to fill line boxes.

    pre-line
    This value directs user agents to collapse sequences of white space. Lines are broken at preserved newline characters, and as necessary to fill line boxes.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Actually, the simplest and easiest approach I found was having… May 11, 2026 at 11:37 pm
  • Editorial Team
    Editorial Team added an answer A bit of searching turned up this open source implementation.… May 11, 2026 at 11:37 pm
  • Editorial Team
    Editorial Team added an answer I really do not have an answer, just an update.… May 11, 2026 at 11:37 pm

Related Questions

I am running into the same problem as in this question: How do you
Here's the background info first. ASP.NET 2.0 Web Site with AJAX Extensions 1.0. I
Does anyone know how I can, in platform-independent C++ code prevent an object from
I am making a input field for keywords, and while the users writing I'm

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.