การใช้งาน Text/Typography ใน Bootstrap 4

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: การใช้งาน Text/Typography ใน Bootstrap 4

การใช้งาน Text/Typography ใน Bootstrap 4

โดย Parichat » 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) ขึ้น

    โค้ด: เลือกทั้งหมด

    <!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>
    ผลลัพธ์
    b1.JPG
    b1.JPG (38.72 KiB) Viewed 5577 times
    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>ทดสอบการใช้งาน 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>
    ผลลัพธ์
    b2.JPG
    อ้างอิง : https://www.w3schools.com/bootstrap4/bo ... graphy.asp

ข้างบน