![]() |
Author : Ishimaru Chiaki Creation : : on 03/10/2008 07:51:50 PM Last modification: : on 03/19/2008 09:17:26 PM Rate and comment this tutorial Print this tutorial |
.


Our xHTML code will thus look like this :1 2 3 | <label>Last name:</label><input type="text" /><br /> <label>First name:</label><input type="text" /><br /> <label>Age:</label><select><option>21</option></select> |
!
!1 2 3 | <label for="lastname">Last name:</label><input type="text" id="lastname" /><br /> <label for="firstname">First name:</label><input type="text" id="firstname" /><br /> <label for="age">Age:</label><select id="age"><option>21</option></select> |
, and it's for this reason that we'll use some CSS.1 2 3 | label { width:150px; /*This is just a sample width, you can modify it if you want*/ } |

!
! So, we need to transform them into block tags with this code :1 2 3 4 | label { display:block; /*The tag becomes block-type*/ width:150px; } |

. Here's the code :1 2 3 4 5 | label { display:block; width:150px; float:left; } |
:
. This method works for all form elements, look :
:1 2 3 4 5 6 | <label for="lastname">Last name:</label><input type="text" id="lastname" /><br /> <label for="firstname">First name:</label><input type="text" id="firstname" /><br /> <label for="age">Age:</label><select id="age"><option>21</option></select><br /> <label for="gender">Gender:</label><input type="radio" name="gender" id="gender" />man<input type="radio" name="gender" />Woman<br /> <label for="ideas">Any idea for my site?</label><textarea id="ideas">Nothing, it's the most beautiful website of the world :D</textarea><br /> <label for="newsletter">Newsletter:</label><input type="radio" id="newsletter" />Receive <input type="radio" />Do not receive |
.
6
Newbies Connected |
7
Requests |
0.0889s
(0.0739s)
Change your template -
Learn more about NP -
Site map
Contact us -
Privacy Policy
-->
Terms of use -
RSS feed -
XHTML 1.0 -
CSS 2.0
There is nothing else to read, you have to go up now !