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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:45:10+00:00 2026-05-25T10:45:10+00:00

I have a form input with a label next to it, like this: <div

  • 0

I have a form input with a label next to it, like this:

<div id="loginbox">
    <form>
        <div>
            <span>Username</span>
            <input type="text">
        </div>

        <div>
            <span>Password</span>
            <input type="password">
        </div>

        <div>
            <input type="submit" value="Login">
        </div>
    </form>
</div>

Then I have some CSS that sets up the width of the login box and the span fields, like so:

#loginbox {
    border: 1px solid black;
    width: 300px;
}

#loginbox span {
    display: inline-block;
    width: 80px;
    text-align: right;
}

Here is the jsfiddle for this code:

http://jsfiddle.net/7TNNq/

Notice how the input boxes do not span the entire length of the div. How do I get it to expand fully?

  • 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-25T10:45:11+00:00Added an answer on May 25, 2026 at 10:45 am

    See: http://jsfiddle.net/thirtydot/tgGLv/

    CSS:

    #loginbox {
        border: 1px solid black;
        width: 300px;
    }
    
    #loginbox label {
        float: left;
        width: 80px;
    }
    #loginbox span {
        display: block;
        overflow: hidden;
        padding: 0 4px 0 0;
    }
    #loginbox span input {
        width: 100%;
    }
    

    HTML:

    <div id="loginbox">
        <form>
            <div>
                <label>Username</label>
                <span><input type="text"></span>
            </div>
    
            <div>
                <label>Password</label>
                <span><input type="password"></span>
            </div>
    
            <div>
                <input type="submit" value="Login">
            </div>
        </form>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a simple form like so (illustrative purposes only)... <form> <div class=input-row> <label>Name</label>
I've got a form: <form action=# method=post id=hubForm> <label class=labelText>Expiration Date:</label> <input class=datBox type=text
Let's say I have an html form. Each input/select/textarea will have a corresponding <label>
I have form with one input for email and two submit buttons to subscribe
I have an input form with two textareas allowing a user to type in
I have a form with many input fields. When I catch the submit form
Using simple_form , I have a simple input like this: <%= f.input :email %>
I have a large form that consists of all the input (text, checkbox, radio,
I have an upload box... <form action=upload_file.php method=post enctype=multipart/form-data><BR> <label for=file>Filename:</label><BR> <input type=file name=file
I am using Codeigniter framework and I have a form with input fields. When

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.