Saif Khan
Saif Khan

Reputation: 18782

form layout with CSS

I need to create a form with, half linear view (textboxes and dropdownlists in separate line) and the other half, non linear view i.e. the textboxes will appear next to each other, like first name and last name will be next to each other.

I am aware how to acomplish the linear view with CSS. I am using

fieldset {
  clear: both;
  font-size: 100%;
  border-color: #000000;
  border-width: 1px 0 0 0;
  border-style: solid none none none;
  padding: 10px;
  margin: 0 0 0 0;
}

label 
{
    float: left;
    width: 10em;
    text-align:right;
}

How can I get the non-linear view?

Upvotes: 1

Views: 867

Answers (2)

Cyril Gupta
Cyril Gupta

Reputation: 13723

display: inline puts the item on the same line.

display: block gives the item an entire line of its own.

float: left floats the item to the left.

Upvotes: 0

Jake
Jake

Reputation: 3457

if you also float:left, set a width and display:inline the other input fields, the should appear on the same line

Upvotes: 1

Related Questions