การใช้งาน Text/Typography ใน Bootstrap 4
โพสต์แล้ว: 12/01/2018 11:21 am
Bootstrap 4 ใช้ font-size เริ่มต้นขนาด 16px และ line-height คือ 1.5 ใช้ font-family คือ "Helvetica Neue", "Helvetica", "Arial", "sans-serif" นอกจากนี้องค์ประกอบทั้งหมดของ <p> มี margin-top: 0 และ margin-bottom: 1rem (ค่าเริ่มต้น 16px ) มาดูการใช้งานของแท็กต่างๆดั่งนี้
- 1.<h1> - <h6> ใน Bootstrap 4 รูปแบบส่วนหัวของ HTML (<h1> - <h6>) มีน้ำหนักตัวอักษร (font-weight) ที่โดดเด่นมากขึ้นและมีการเพิ่มขนาดตัวอักษร (font-size) ขึ้น
ผลลัพธ์ 2.Display Headings จะมี font-size ที่ใหญ่และ font-weight ที่เบา Display Headings มี Class มาให้เลือก 4 Class ด้วยกัน คือ .display-1, .display-2, .display-3, .display-4
โค้ด: เลือกทั้งหมด
<!DOCTYPE html> <html lang="en"> <head> <title>ทดสอบการใช้งานเเท็ก h1-h6</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h1>ขนาดตัวอักษรของ h1 (2.5rem = 40px)</h1> <h2>ขนาดตัวอักษรของ h2 (2rem = 32px)</h2> <h3>ขนาดตัวอักษรของ h3 (1.75rem = 28px)</h3> <h4>ขนาดตัวอักษรของ h4 (1.5rem = 24px)</h4> <h5>ขนาดตัวอักษรของ h5 (1.25rem = 20px)</h5> <h6>ขนาดตัวอักษรของ h6 (1rem = 16px)</h6> </div> </body> </html>
ตัวอย่างผลลัพธ์ อ้างอิง : https://www.w3schools.com/bootstrap4/bo ... graphy.aspโค้ด: เลือกทั้งหมด
<!DOCTYPE html> <html lang="en"> <head> <title>ทดสอบการใช้งาน Display Headings</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h1>ทดสอบการใช้งาน Display Headings</h1> <hr> <h1 class="display-1">รูปแบบของ Display 1</h1> <h1 class="display-2">รูปแบบของ Display 2</h1> <h1 class="display-3">รูปแบบของ Display 3</h1> <h1 class="display-4">รูปแบบของ Display 4</h1> </div> </body> </html>