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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:45:56+00:00 2026-05-14T21:45:56+00:00

I need to simulate the look of a typical paper form in CSS. It

  • 0

I need to simulate the look of a typical paper form in CSS. It consists of a two-column table of fields. Each field consists of a field name (of variable width) followed by an underline that continues to the end of the column. The field might be populated, in which case there is some text centered above the line, or it may be blank. If that isn’t clear, he’s a rough idea in manky ASCII art:

Name: _______Foo_______  Age: _____17______
Location: __Melbourne__  Handedness: _Left_

(except that the underline would continue under any text)

To implement the underline without text, I assume I should use a border-bottom rather than a text-decoration: underline. Additionally, I need the bordered element to take up the full available space. Both of those argue for a block-level element. However, I can’t find any way to get the block level element (either a div, an li, or a span set to display: block or inline-block) to remain on the same line as the label. As soon as I give it a width: 100%, it newlines. I’ve tried various combinations of floats, and I’m not inclined to do anything ridiculous with absolute positioning. Any recommendations?

  • 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-14T21:45:57+00:00Added an answer on May 14, 2026 at 9:45 pm

    I have two solutions for you. One is nice, but does not work in IE. One is ugly, but seems to work everywhere. First, the nice one, using divs and css:

    <style type="text/css"> 
      .container { width:500px; }
      .field { width:240px; display:table; float:left; }
      .label { white-space:nowrap; display:table-cell; width:1px; } 
      .data { border-bottom: solid 1px black; width="100%";text-align:center; margin-left:10px; white-space:nowrap; display:table-cell; } 
      .row { display:table-row; }
    </style> 
    
    <div class="container"> 
      <div class="field"> 
        <div class="row"> 
          <div class="label">label 1</div> 
          <div class="data">data 1</div> 
        </div>
      </div>
      <div class="field"> 
        <div class="row"> 
          <div class="label">label 2</div> 
          <div class="data">data 2 </div> 
        </div>
      </div>
      <div class="field"> 
        <div class="row"> 
          <div class="label">label 3</div> 
          <div class="data">data 3 </div> 
        </div>
      </div>
      <div class="field"> 
        <div class="row"> 
          <div class="label">label 4</div> 
          <div class="data">data 4 </div> 
        </div>
      </div>
    </div>
    

    Since IE doesn’t support table-cell (etc), we need an ugly one:

    <style type="text/css">
      .table-field { width:240px; display:table; float:left; }
      .table-label { white-space:nowrap; } 
      html>body .table-label { width:1px; }  /* force firefox to shrink label to fit text */
      .table-data { border-bottom: solid 1px black; width="100%";text-align:center; white-space:nowrap; } 
    </style> 
    
    <div class="container"> 
      <table class="table-field"><tr><td class="table-label">label 1</td><td class="table-data">data 1</td></tr></table>
      <table class="table-field"><tr><td class="table-label">label 2</td><td class="table-data">data 2</td></tr></table>
      <table class="table-field"><tr><td class="table-label">label 3</td><td class="table-data">data 3</td></tr></table>
      <table class="table-field"><tr><td class="table-label">label 4</td><td class="table-data">data 4</td></tr></table>
      <table class="table-field"><tr><td class="table-label">label 5</td><td class="table-data">data 5</td></tr></table>
      <table class="table-field"><tr><td class="table-label">label 6</td><td class="table-data">data 6</td></tr></table>
    </div>
    

    Either way, this needs colors and margins/padding to look good.

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

Sidebar

Related Questions

I need to simulate how my application will look when a user is driving
I need to simulate a form that is similar to the interface seen during
I'm need to simulate a web form's ability to include as many File inputs
I need to redirect an user, but I need to simulate some form processing,
I need to simulate a test scenario in which I call the getBytes() method
I need to simulate multiple embedded server devices that are typically used for motor
I need to simulate a memory-hungry process. For example, On a machine with 4.0
I'm writing an app where I need to simulate key press events on a
I'm looking for a jquery plugin to simulate a vertical marquee. I need it
I am working on a Java project and need to have a keypress simulate

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.