clear both CSS กับการขึ้นบรรทัดใหม่ของ Elements
บทความวันที่ 28 ธันวาคม 2555
คำสั่ง clear ของภาษา CSS มีไว้สำหรับการระบุว่า Elements ใด ๆ ก็ตามที่มีการระบุคำสั่ง clear จะไม่มี Elements อื่นใดมาต่อทางฝั่งซ้าย หรือทางฝั่งขวาได้ในตำแหน่งแถวเดียวกัน
ตัวอย่างโปรแกรม
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>amplysoft.com รับเขียนเว็บ รับทำเว็บ เรียนเขียนโปรแกรม</title></head><body><style type="text/css">.box1 { border:solid 1px blue; padding:3px; clear:both; width:300px; margin:3px;}#box2 { border:solid 1px green; padding:3px; clear:both; width:300px; margin:3px;}</style><div class='box1'>Box 1</div><div id='box2'>Box 2</div><div class='box1'>Box 3</div></body></html> |
ผลลัพธ์
