CSS Tips and Tricks


- สำหรับ 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/

คำสำคัญ (Tags): #css#tip
หมายเลขบันทึก: 53989เขียนเมื่อ 10 ตุลาคม 2006 09:41 น. ()แก้ไขเมื่อ 11 กุมภาพันธ์ 2012 16:05 น. ()สัญญาอนุญาต: จำนวนที่อ่านจำนวนที่อ่าน:


ความเห็น (1)

body { font-size: 62.5% }

ปกติบราวเซอร์ทั่วไป defualt 16px แต่ 62.5% ของ 16px = 10px นั้นกำหนดขนาด ให้มันเท่ากับ 10px

 ดังนั้น 1em = 10px เมื่อ tag ต่าง inherit ค่า font มาจาก body

พบปัญหาการใช้งานกรุณาแจ้ง LINE ID @gotoknow
ClassStart
ระบบจัดการการเรียนการสอนผ่านอินเทอร์เน็ต
ทั้งเว็บทั้งแอปใช้งานฟรี
ClassStart Books
โครงการหนังสือจากคลาสสตาร์ท