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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:57:49+00:00 2026-05-10T14:57:49+00:00

I want the following layout to appear on the screen: FieldName 1 [Field input

  • 0

I want the following layout to appear on the screen:

FieldName 1             [Field input 1] FieldName 2 is longer   [Field input 2]     .                         .     .                         . FieldName N             [Field input N] 

Requirements:

  • Field names and field inputs must align on the left edges
  • Both columns must dynamically size themselves to their content
  • Must work cross-browsers

I find this layout extremely simple to do using HTML tables, but since I see a lot of CSS purists insisting that tables only be used for tabular data I figured I’d find out if there was a way to do it using CSS.

  • 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-10T14:57:50+00:00Added an answer on May 10, 2026 at 2:57 pm

    I think most of the answers are missing the point that the original questioner wanted the columns widths to depend on the width of the content. I believe the only way to do this with pure CSS is by using display: table, display: table-row and display: table-cell, but that isn’t supported by IE. But I’m not sure that this property is desirable, I find that creating a wide columns because there is a single long field name makes the layout less aesthetically pleasing and harder to use. Wrapped lines are fine in my opinion, so I think the answers that I just suggested were incorrect are probably the way to go.

    Robertc’s example is ideal but if you really must use tables, I think you can make it a little more semantic by using <th> for the field names. I’m not sure about this so please someone correct me if I’m wrong.

    <table>     <tr><th scope="row"><label for="field1">FieldName 1</label></th>         <td><input id="field1" name="field1"></td></tr>     <tr><th scope="row"><label for="field2">FieldName 2 is longer</label></th>         <td><input id="field2" name="field2"></td></tr>     <!-- ....... --> </table> 

    Update: I haven’t been following this closely, but IE8 apparently supports CSS tables, so some are suggesting that we should start using them. There’s an article on 24 ways which contains a relevant example at the end.

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

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • 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
  • added an answer The first version works with any container and so is… May 11, 2026 at 2:10 pm
  • added an answer I made the same type of call for another project.… May 11, 2026 at 2:10 pm
  • added an answer If you only want your own project (TemplateMatching) to use… May 11, 2026 at 2:10 pm

Related Questions

I want to ran the following script on text files that are being committed:
I want to receive the following HTTP request in PHP: Content-type: multipart/form-data;boundary=main_boundary --main_boundary Content-type:
I want to do the following: <%=var t = ViewData.Model%> but in VB
I want to accomplish the following scenario in Drupal: You have 2 content-types. Lets
Table layout: CREATE TABLE t_order (id INT, custId INT, order DATE) I'm looking for
I am having a qt question. I want the QLineEdit widget to have the
I want the log to roll over as long as the application is running,
I've been a web developer for really quite some time now, but this is

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.