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

วิธีทำตัวอักษรตัวหนา (Bold) ใน HTML

เพื่อทำตัวอักษรตัวหนาใน HTML ใช้ Tag <b>...</b> หรือ <strong>...</strong> ทั้งคู่ทำงานเหมือนกัน แต่ <strong> เพิ่ม Semantic Importance (ความสำคัญทางความหมาย) ส่วน <b> เป็น Physical Markup เท่านั้น

ยังสามารถทำได้ด้วย CSS Property font-weight: bold;

วิธีทำตัวอักษรตัวหนา (Bold) ใน HTML

ตัวอย่างใช้ <strong>

<!DOCTYPE html> <html> 
  <head> 
    <title>HTML text bold</title> 
  </head> 
  <body> 
    <h2>Our Products</h2> 
    <p>Developed 10 <strong>Android</strong> apps till now.</p> 
  </body> 
</html>

ตัวอย่างใช้ font-weight

<!DOCTYPE html> <html> 
  <head> 
    <title>HTML text bold</title> 
  </head> 
  <body> 
    <h1>Tutorialspoint</h1> 
    <p style="font-weight: bold;">Simply Easy Learning</p> 
  </body> 
</html>