javascript - aligning input tags using css -
.label{ padding: 10px; font-weight: bold; } input{ padding: 10px; margin: 0 0 10px 0; text-align: left; } <label class="label">user </label><input type="text" name="usr"/><br> <label class="label">pass </label><input type="text" name="pass"/><br> <label class="label">user </label><input type="text" name="rpass"/><br> i'm new css, , want align textfields when run see text fields not in line. maybe because of label tag. should write css label tag ? can css properties?
its unclear mean not aligned. tried in fiddle , horizontally aligned me. guess labels of different lengths , therefore pushing inputs different distances right. fix add styling labels set them same width regardless of content. try
.label{ padding: 10px; font-weight: bold; display: inline-block; width: 40px; /* don't use 40px, try , figure out works best case */ }
Comments
Post a Comment