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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:35:42+00:00 2026-05-26T22:35:42+00:00

Here’s some CSS and HTML to make a textarea below a list of data

  • 0

Here’s some CSS and HTML to make a textarea below a list of data points:

form label {
  width: 140px;
  float: left;
}
form ol li {
  background: #98c8dc;
  list-style: none;
  padding: 5px 10px;
}

<form>
<ol>
<li>
  <label><br/><br/><br/><br/>Recent data</label>
  <ol>
  <li>3 99</li>
  <li>5 98</li>
  <li>15 97</li>
  <li>28 96</li>
  </ol>
</li>
<li>
  <label>New data</label>
  <textarea placeholder="30 95" rows="4"></textarea>
</li>
</ol>
</form>

It renders like this:

enter image description here

How would you recommend I get it to line up just right?
Namely, “Recent data” should line up with the “28 96” line and, perhaps trickiest, the “30 95”, despite being in the textarea, should line up as if it’s just another row that comes after the “28 96”.

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

    This is a good case for CSS positioning. Elements with position:absolute are positioned relative to their closest positioned parent. That means we can anchor the labels to the top/left of their containers using position:relative on the <ol>, and position:absolute on the label.

    Example here: http://jsfiddle.net/YhQYS/1/

    HTML:

    <form action="." method="post">
        <ol>
            <li class="recent-data">
              <strong>Recent data</strong>
              <ol>
                  <li>3 99</li>
                  <li>5 98</li>
                  <li>15 97</li>
                  <li>28 96</li>
              </ol>
            </li>
            <li class="new-data">
              <label>New data</label>
              <textarea placeholder="30 95" rows="4"></textarea>
            </li>
        </ol>
    </form>
    

    CSS:

    form > ol {
        background: #98c8dc;
        font-family: serif;
    }
    .recent-data > ol,
    .new-data > ol {
        list-style: none;
        padding: 5px 10px 5px 0;
        line-height:20px;
    }
    .recent-data li { padding-left:5px; }
    .recent-data,
    .new-data {
        position:relative;
        padding-left:140px;
    }
    .recent-data strong,
    .new-data label {
        position:absolute;
        left:10px;
        line-height:20px;
    }
    .recent-data strong { bottom:5px; }
    .new-data label { top:5px; }
    .new-data textarea {
        font-family:serif;
        font-size:100%;
        padding:4px;
    }
    

    This is very simple to reason about, and reliable cross-browser. Note that you shouldn’t use a <label> that doesn’t have a correspondent form control.


    But that stuff looks like tabular data… it’s your choice, we don’t have enough context to know what mark-up is more appropriate. So here is a more semantically correct approach using tables, rowspan and vertical-align:

    HTML:

    <form action="." method="post">
        <table id="results">
            <tbody>
                <tr>
                    <th rowspan="4" scope="row" class="recent-label">Recent data</th>
                    <td>2</td>
                    <td>47</td>
                </tr>
                <tr>
                    <td>3</td>
                    <td>99</td>
                </tr>
                <tr>
                    <td>5</td>
                    <td>98</td>
                </tr>
                <tr>
                    <td>5</td>
                    <td>98</td>
                </tr>
                <tr>
                    <th rowspan="1" scope="row" class="new-label">New data</th>
                    <td colspan="2" class="new-data">
                        <textarea>23</textarea>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    

    CSS:

    form {
        background: #98c8dc;
        font-family: serif;
    }
    #results th,
    #results td {
        padding:3px 5px;
    }
    
    #results .recent-label {
        vertical-align:bottom;
    }
    #results .new-label {
        vertical-align:top;
    }
    #results .new-data {
        padding-left:0px;
    }
    #results textarea {
        padding:4px; // +1px border
        font-size:100%;
        font-family:serif;
    }
    

    Sample at http://jsfiddle.net/quqf8/1/

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

Sidebar

Related Questions

Here is an example: I write html code inside of textarea, then I swap
Here's a problem I ran into recently. I have attributes strings of the form
Here is my code, which takes two version identifiers in the form 1, 5,
Here is the css: #content ul { font-size: 12px; } I am trying this:
Here is a scenario: User installs .NET application that you have made. After some
Here an example of my checkbox list http://jsfiddle.net/YnM2f/ Let's say I check on G
here's what we have today: * NxM grid of points in 3D * we
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
Here is a snippet of my xaml: <ComboBox x:Name=cbo1 Width=100 SelectedValue=200> <ComboBoxItem Name=n1>100</ComboBoxItem> <ComboBoxItem

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.