CSS (Flexible Text)

- Understand that IE/Win users cannot resize text set with pixel. - Keywords offer a simple,easy-to-grasp method of sizing text that permit user resizing. - Percentages can make future updates or user-defined style sheets a quick and easy way to modify an entire site's text size with one CSS rule. - Using the keyword/percentage combination can still allow a certain level of precision when targeted at default browser settings. เข้าใจผิดมาตลอดว่าที่ต้องกำหนดขนาด font ใน CSS เพื่อบังคับให้ user ไม่สามารถเปลี่ยนขนาด font ด้วยตัวเองได้ เป็นเรื่องที่ถูกต้อง จริงๆแล้ว ไม่ใช่เรื่องที่ถูกเลย เพราะว่าเหตุการณ์ ที่ user ถูกบังคับไม่ให้สามารถขยายขนาด font จะเกิดกับ IE เท่านั้น (browser อื่นไม่มีผล ลองกับ firefox แล้วถึงจะบังคับยังไงก็ยัง Ctrl + ได้อยู่) มาตรฐาน CSS เค้าบอกว่า ควรกำหนดขนาด font ด้วย keyword แล้วเพิ่ม,ลดขนาดด้วย percentages เอา เช่น [code] body { font-size: small; } h1 { font-size: 150%; } h2 { font-size: 130%; } .note { font-size: 85%; } [/code] ิ*** nesting percentages จะมีบางกรณีที่ต้องดูให้ดีๆเช่น HTML [code]

Hi

This is body text at default base size

[/code] CSS [code] body { font-size: small; } h1 { font-size: 150%; } #container { font-size: 95%; } [/code] แบบนี้จะหมายความว่า h1 ใน container จะมีขนาดเป็น 150% ของ container (95%)