Jump to content

Setting label width using CSS


ThePsion5

Recommended Posts

Hi,I'm creating a form and I want to set the width of all labels for that form. I assumed that the CSS for this would be quite simple:

label{width: 250px;}

But this code doesn't work at all - at least not in the latest version of Firefox. Any ideas what I may be doing wrong and the proper way to go about this? Thanks!

Link to comment
Share on other sites

Add this to your css:display: block;I'm really not sure what side effects that might cause, but give it a try.
I could do that, but the form I'm creating has the labels on the left side and the input elements on the right side. Here's a sample of the HTML:
<label for="first_name">First Name</label><input type="text" id="first_name"  /><br /><label for="last_name">Last Name</label><input type="text" id="first_name"  /><br /><label for="address1">Address</label><input type="text" id="address1"  />

The idea behind my CSS is that I can have the labels be the same width so the form input elements are all aligned from the left side (without using any form of tables). Any ideas?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...