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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:44:59+00:00 2026-05-23T16:44:59+00:00

I have a column with labels and corresponding text boxes, viz: <table> <tr> <td>Label:</td>

  • 0

I have a column with labels and corresponding text boxes, viz:

<table>
  <tr>
  <td>Label:</td>
  <td><input type="text"></input></td>
  </tr>
  <tr>
  <td>longer label:</td>
  <td><input type="text"></input></td>
  etc...

I want to ensure the first column is wide enough to allow the text in one line, but no wider than necessary, that to allow maximum space for the input boxes (which are set to width 100%). So I don’t want to set a specific percentage or explicit width, just something to say “as small as possible but no smaller.”

Is there a way to do this in raw html/CSS or do I have to resort to Javascript?

(Obviously if the page is very narrow this is not achievable, but I’m not worried about really narrow browsers.)

  • 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-23T16:45:00+00:00Added an answer on May 23, 2026 at 4:45 pm

    As long as you don’t set width for the table,tr or td, td‘s text will be in one line. If the space is not enough you can use td {white-space:nowrap}. This will not allow the text to go to second line, but will show a scrollbar.

    Demo (JsFiddle)

    td {white-space:nowrap}
    <table>
        <tr>
            <td>Label:</td>
            <td><input type="text"></td>
        </tr>
        <tr>
            <td>longer label:</td>
            <td><input type="text"></td>
        </tr>
         <tr>
            <td>longeeeeeeeeeest label:</td>
            <td><input type="text"></td>
        </tr>
    </table>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In gridview's column i have a linkbutton and a label under it. I want
I have a table. The first column contains labels. The rest of the columns
I have a label function like : private function formatDate (item:Object, column:DataGridColumn):String { var
I need a select from table which does not have column that tells when
I have a column which is of type nvarchar(max). How do I find the
I have a form input , and the label spans multiple lines, and I
BACKGROUND: I would like to have small labels in columns of a table. I'm
Now am using repeater control and create three labels and corresponding textbox. I want
I want to create a label or textbox based on database column value.. For
I have an excel spreadsheet with two columns. The first column is a label

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.