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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:06:03+00:00 2026-06-04T17:06:03+00:00

I need to align labels and inputs of my form using CSS. The result

  • 0

I need to align labels and inputs of my form using CSS. The result should be something like this (I hope this simple scheme is clear):

Label1:    ______
Labellll2: ______
Button

So, my HTML and CSS look as follows. The problem is that labels are placed on top of inputs, and also the button is on the right side instead of a bottom.

<form width="200px" name="optform" method="post" action="#">
        <div class = "boxx">
            <label for="param1">Param1:</label>
            <input type="text" class="input-text" value="5" size="11" maxlength="11" name="param1" id="param1">
            <label for="param2">Param1:</label>
            <input type="text" class="input-text" value="5" size="11" maxlength="11" name="param2" id="param2">
        </div>
        <div class="buttons">
             <a href="#">
                  <img src="images/opt.png" alt=""/> Run 
             </a>
       </div>

div.boxx {
    width: 500px;
}
div.boxx .input-text{
    border:1px solid #A9C7F5;
    color: #00557F;
    font: 12px Arial;
    float:left;
    width:66%;
    margin:0 0 0.5em 0.25em;
}

div.boxx label{
    display:block;
font: 13px Arial;
color:#00557F;
width:33%;
float:left;
text-align:left;
padding-right: 8px;
}
.buttons a, .buttons button {
    -moz-border-bottom-colors: none;
    -moz-border-image: none;
    -moz-border-left-colors: none;
    -moz-border-right-colors: none;
    -moz-border-top-colors: none;
    background-color: #DFF4FF;
    border-color: #EEEEEE #DEDEDE #DEDEDE #EEEEEE;
    border-style: solid;
    border-width: 1px;
    color: #565656;
    cursor: pointer;
    font-family: Verdana,arial,sans-serif;
    font-size: 11px;
    font-weight: bold;
    line-height: 130%;
    margin: 10px 10px 0 0;
    padding: 4px 10px 3px 7px;
    text-decoration: none;
}
.buttons button {
    overflow: visible;
    padding: 4px 10px 3px 7px;
    width: auto;
}
  • 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-06-04T17:06:05+00:00Added an answer on June 4, 2026 at 5:06 pm

    The label needs to be

     display:inline-block;
    

    and the width is too large of either your label or input boxes. Padding and margins will cause problems with percentage widths because they are not taken into account.

    Here is the updated css

    div.boxx { 
    width: 500px; 
    } 
    div.boxx .input-text{ 
    border:1px solid #A9C7F5; 
    color: #00557F; 
    font: 12px Arial;     
    width:60%; 
    margin:0 0 0.5em 0.25em; 
    } 
    
    div.boxx label{ 
    display:block; 
    font: 13px Arial; 
    color:#00557F; 
    width:33%; 
    float:left; 
    text-align:left; 
    padding-right: 8px; 
    } 
    .buttons a, .buttons button { 
    -moz-border-bottom-colors: none; 
    -moz-border-image: none; 
    -moz-border-left-colors: none; 
    -moz-border-right-colors: none; 
    -moz-border-top-colors: none; 
    background-color: #DFF4FF; 
    border-color: #EEEEEE #DEDEDE #DEDEDE #EEEEEE; 
    border-style: solid; 
    border-width: 1px; 
    color: #565656; 
    cursor: pointer; 
    font-family: Verdana,arial,sans-serif; 
    font-size: 11px; 
    font-weight: bold; 
    line-height: 130%; 
    margin: 10px 10px 0 0; 
    padding: 4px 10px 3px 7px; 
    text-decoration: none; 
    } 
    .buttons button { 
    overflow: visible; 
    padding: 4px 10px 3px 7px; 
    width: auto; 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my markup, I need to align gray label under the blue label
I need help to align CSS buttons. I tried many different variations and I
I need to align two divs next to each other, so that each contains
I have a div where I need to align text in a vertical fashion
Need some help please with this error : TypeError : 'unicode' object does not
I'm using Symfony 2 and I need to execute a javascript just after the
I need to align text to right in a TextBox which is in a
I am trying to populate some fields on a form using the onchange method
I have an asp.net content form which contains a couple of textboxes. I need
i need again your help... I have this php code: <? if(isset($_POST['addnews'])){ $type =

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.