thiết kế form theo tableless style 2007-07-08 08:37:27

HTML tạo form không sử dụng table:

[CSS]
label{
float: left;
width: 120px;
font-weight: bold;
}

input, textarea{
width: 180px;
margin-bottom: 5px;
}

textarea{
width: 250px;
height: 150px;
}

.boxes{
width: 1em;
}

#submitbutton{
margin-left: 120px;
margin-top: 5px;
width: 90px;
}

br{
clear: left;
}
input:focus, textarea:focus{
background-color: lightyellow;
}
[/CSS]

<form>

<label for="user">Name</label>
<input type="text" name="user" value="" /><br />

<label for="emailaddress">Email Address:</label>
<input type="text" name="emailaddress" value="" /><br />

<label for="comments">Comments:</label>
<textarea name="comments"></textarea><br />

<label for="terms">Agree to Terms?</label>
<input type="checkbox" name="terms" class="boxes" /><br />

<input type="submit" name="submitbutton" id="submitbutton" value="Submit" />

</form>

Tra loi 5 comment(s) TG 2007-07-08 08:37:27

noname 2007-07-10 10:12:19

TG giải thích thêm cho rõ ràng. Ví dụ cái
br{
clear: left;
}
có ý nghĩa gì

.boxes{
width: 1em;
}
là sao, mình không hiểu "em" là đơn vị nào,
Với lại cái tabless form này chỉ chạy đúng trên FF

Tra loi

TG 2007-07-10 10:25:48

bạn đọc trong mục CSS http://phpbasic.com/?php=tutorial&basic=view&id=css về thuộc tính clear và đơn vị chiều dài để rõ thêm

Tra loi

Doangia 2007-07-11 11:21:53

Đây ko phải là cách hay để tut ... chỉ đưa code thế thì khó hiểu lắm

Tra loi

TG 2007-07-11 11:41:37

bài này sẽ được move vào mục Reference, chủ  yếu là để tham khảo chứ không giải thích được tác dụng từng tag

Tra loi

Friend 2007-07-11 11:51:56

1 em = 0.1 px , Đã nhập đủ 20 kí tự .

Tra loi

Y kien