PDA

View Full Version : completely replace table - label width & justification?



Serenity7
Nov 9th, 2006, 05:03 PM
I was given this mostly-ugly nested table and asked to completely replace it with xhtml/css.

http://img46.imageshack.us/img46/3838/picture1pg3.png

For the labels, I tried using width and text-align properties on the label tag in an attempt to duplicate it, but that didn't seem to work - they all just ignored both properties. And then there's that nested-table Password section, ugh!

If you have an example of doing this sort of thing and don't mind sharing, please point to it.

thanks,
_S

mark87
Nov 11th, 2006, 12:26 AM
There is a lot on the net about creating pure CSS (tableless) forms.

Here's a basic method: http://www.quirksmode.org/css/forms.html

And here's something a little more advanced: http://jeffhowden.com/code/css/forms/

SWG
Nov 11th, 2006, 05:38 PM
I don't see why you shouldn't use a table anyway... Especially if you don't know how to do it with DIV's.

Basically, what you're saying, is they want you to make that form into XHTML and CSS? I'm confused if you're wanting it to be designed with purely XHTML and CSS, or you just want it in DIV's and not a table.

Usually when I make a form, I make it with a table although it may require more coding. Tables were built for this kind of thing (tabular data).

So if I were you, I'd do this:


<table border="0" cellpadding="0" cellspacing="5">
<tr>
<td width="Specify the width allowed for the names of the forms in pixels.">
Name of first form here.
</td>
<td>
HTML for the first form here.
</td>
</tr>
<tr>
<td width="Specify the same width you specified last time.">
</td>
<td>
HTML for submission button.
</tr>
</table>


Basically, all you have to do is copy and paste...


<tr>
<td width="Specify the width allowed for the names of the forms in pixels.">
Name of first form here.
</td>
<td>
HTML for the first form here.
</td>
</tr>

for each form field.

But, if you want to use CSS and DIV's etc... Go ahead. They both work fine.

mark87
Nov 11th, 2006, 06:04 PM
Usually when I make a form, I make it with a table although it may require more coding. Tables were built for this kind of thing (tabular data).

I don't see how you can justify a form being tabular data? :confused:

lorelai13
Oct 28th, 2009, 01:07 AM
I looked for a solution a couple of hours ago and found one using <ul><li> and <labels>

You can see it here: http://www.florinraicu.com/input-formatting-apply-width-to-a-label/