- สำหรับ Text Size
body { font-size: 62.5% }
ใช้ em แืทน px (10px = 1.0em)
- ให้ Code ดูอ่านง่าย ดูให้ header tags เช่น
h1 {}
h1#logo { font-size: 2em; color: #000; }
h2 {}
h2.title { font-size: 1.8em; font-weight: normal; }
- แยก Code เป็น Block เช่น
/* Structure */ : วาง structure, class, div
/* images */ : เกี่ยวกับรูป
- อย่าใช้ DIV มากเกินไป
- ทำทุกอย่างแค่ครั้งเดียว เช่น
margin: 0; padding: 0;
สามารถใช้
* { margin: 0; padding: 0; }
Ref : http://www.blogherald.com/2006/09/08/css-tips-and-tricks/
body { font-size: 62.5% }
ปกติบราวเซอร์ทั่วไป defualt 16px แต่ 62.5% ของ 16px = 10px นั้นกำหนดขนาด ให้มันเท่ากับ 10px
ดังนั้น 1em = 10px เมื่อ tag ต่าง inherit ค่า font มาจาก body