tags:

views:

18

answers:

2

I have a definition list and I would like the text description to stay above the textbox. The text however is to the left of the box. Here is the html.

<dl>
  <dt>
    <label>Phone Number</label>
  </dt>
  <dd>
    <input name="phone" type="text"/>
  </dd>
</dl>

Here is the css.

dl {font:normal 12px/15px Arial; position: relative; width: 350px;}
dt {clear: both; float:left; width: 130px; padding: 4px 0 2px 0; text-align: left;}
dd {float: left; width: 200px; margin: 0 0 8px 0; padding-left: 6px;}
A: 

Try adding Display:block to the dt and dd definitions (haven't tested this, just a thought).

Edelcom
Thanks Edelcom. I added that to both tags but still the same. The test is still to the left of the textboxes.
Jon
I hadn't noticed the float:left ... there goes my points :)
Edelcom
+1  A: 

Remove all the float:left; rules. What you describe is the default behaviour.

Álvaro G. Vicario
Álvaro, thanks. It worked.
Jon