Forum Moderators: open

Message Too Old, No Replies

Semantic Form's Markup(DIV vs BR)

Semantic Markup

         

TaoDay

10:07 am on Feb 9, 2007 (gmt 0)

10+ Year Member



Dear Friends!

My trouble: My form display correct in IE & Firefox. But I think my code is not semantic enought.

Solution: Could we discuss about the way which is the best for form markup - Semantic.

Example login form:
Quote:
_____Usename *: [Input]
____Passwords *: [Input]
________________[Submit button]

Source code Xhtml:

Use Break per line:

Code:

<form action="WebStandard.html" method="post">
<div id="strictDTD_cheat">
<label for="uName">Username:</label>
<input type="text" name="uName" id="uName" /><br />

<label for="pName">Password:</label>
<input type="text" name="pName" id="pName" /><br />

<input type="submit" name="Submit" value="Submit" />
</div>
</form>

Split form into Division(line)

Code:

<form action="WebStandard.html" method="post">
<div id="username">
<label for="uName">Username:</label>
<input type="text" name="uName" id="uName" />
</div>

<div id="password">
<label for="pName">Password:</label>
<input type="text" name="pName" id="pName" />
</div>

<div id="formActions">
<input type="submit" name="Submit" value="Submit" />
</div>
</form>

mattur

4:47 pm on Feb 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd go with div's, but either way will work fine. Using div's allows you the option to easily style label/input pairs.

ronin

4:54 pm on Feb 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does anyone have any idea when

Line One <br />
Line Two

is due to be replaced with:

<l>Line One</l>
<l>Line Two</l>

Or has that development been shelved?