Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> HTML

วิธีใช้ตัวอักษรขนาดเล็ก (Small Font) ใน HTML

เพื่อตั้งค่าตัวอักษรขนาดเล็กใน HTML ใช้ attribute style attribute style ระบุ inline style สำหรับองค์ประกอบ ใช้กับแท็ก HTML <p> พร้อม CSS property font-size HTML5 ไม่รองรับแท็ก <font> จึงใช้ CSS style แทน

จำไว้ว่า การใช้ style attribute จะ override สไตล์ที่ตั้งค่าไว้แบบ global จะทับท書きสไตล์ในแท็ก HTML <style> หรือ external style sheet

วิธีใช้ตัวอักษรขนาดเล็ก (Small Font) ใน HTML

ตัวอย่าง

<!DOCTYPE html> 
<html> 
  <head> 
    <title>HTML smaller font</title> 
  </head> 
  <body> 
    <h1>Heading</h1> 
    <p>This is demo content.</p> 
    <p style="color:blue;font-size:11px;">This text will be smaller.</p> 
  </body> 
</html>

ผลลัพธ์

วิธีใช้ตัวอักษรขนาดเล็ก (Small Font) ใน HTML