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

  • Home
  • SEARCH
  • 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 6725729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:50:31+00:00 2026-05-26T09:50:31+00:00

I have two textboxes (part of a form), in the same line, and under

  • 0

I have two textboxes (part of a form), in the same line, and under each of them I want to place a <span> to show any errors with the data filled. The problem I’m facing is that the size of the error under the first box changes the position of the error under the second box.

I’ve added some images for clearer understanding.

Standard error size

longer error

Here is my html code:

            <form id="notify" method="post" action="add_notify.php">            
            Name: <input type="text" class="formname" name="name" value="" size="20"/>
            Email: <input type="text" class="formname" name="from" value="" size="20"/>
            <input type="submit" class="sendform" name="submit" onclick="processInfo()" value="Go!"/>
            <br/>
            <span id="name_error" class="nameerror">Name Error foo bar blah blah</span>
            <span id="email_error" class="emailerror">Email Error</span>
            </form>

Here is the relevant CSS:

.formname{
    background: #FFFFFF;
    font-family: helvetica, arial, sans-serif;
    color: #000000;
    padding: 10px;
    border: 1px solid #30435D;
    font-size: 18px;
    margin: 0 15px 0 0;
    width: 170px;
    font-weight: bold;
}
.nameerror, .emailerror
{
    color:red;
    font-size:small;
    padding-left:60px;
    width:300px;


}
.emailerror
{
    padding-left:200px;

}
  • 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-26T09:50:32+00:00Added an answer on May 26, 2026 at 9:50 am

    Use floating <div> to show the errors. Block level element is needed so that the width will affect it.

    HTML:

    <div id="name_error" class="nameerror">Name Error  foo bar blah blah blah blah blah blah blah</div>
    <div id="email_error" class="emailerror">Email Error</div>
    <div style="clear: both;"></div>
    

    And the CSS:

    .nameerror, .emailerror
    {
        float: left;
        color: red;
        font-size: small;
        width: 170px;
    }
    
    .nameerror
    {
        margin-left: 45px;
    }
    .emailerror
    {
        margin-left: 90px;
    }
    

    Live test case.

    The extra <div> with “clear” is required to show further contents properly, also changed the width to the same width as the input boxes, no point having the errors longer than the inputs they represent.

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

Sidebar

Related Questions

I have an HTML form containing some textboxes and two jqGrids. The user selects
I have two textboxes which uses the same class (they both need to be
I have two textboxes Textbox1 and Textbox2 and 1 gridview i want my site
I have custom control with two textboxes and one drop down list. I want
I'm using the jQuery datepicker where I have two textboxes (start date / end
I have user control named DateTimeUC which has two textboxes on its markup: <asp:TextBox
I currently have two text boxes which accept any number. I have a text
I have a form with two text boxes, one select drop down and one
I have a simple in VB/ASP.NET form containing two text boxes, I am attempting
I have two CheckBoxes and a TextBox. I want to TextBox to have IsEnabled=False

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.