โดย 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 (38.72 KiB) Viewed 5661 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>
ผลลัพธ์
อ้างอิง : https://www.w3schools.com/bootstrap4/bo ... graphy.asp
[b][color=#FF0080][size=150][url=https://www.mindphp.com/forums/viewforum.php?f=76]Bootstrap[/url] 4[/size][/color][/b] ใช้ font-size เริ่มต้นขนาด 16px และ line-height คือ 1.5 ใช้ font-family คือ "Helvetica Neue", "Helvetica", "Arial", "sans-serif" นอกจากนี้องค์ประกอบทั้งหมดของ <p> มี margin-top: 0 และ margin-bottom: 1rem (ค่าเริ่มต้น 16px ) มาดูการใช้งานของแท็กต่างๆดั่งนี้
[list][b][color=#FF0080]1.<h1> - <h6>[/color][/b] ใน Bootstrap 4 รูปแบบส่วนหัวของ HTML (<h1> - <h6>) มีน้ำหนักตัวอักษร (font-weight) ที่โดดเด่นมากขึ้นและมีการเพิ่มขนาดตัวอักษร (font-size) ขึ้น
[code]<!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>[/code]
[b][color=#FF0000]ผลลัพธ์[/color][/b]
[attachment=1]b1.JPG[/attachment]
[color=#FF0080][b]2.Display Headings [/b][/color]จะมี font-size ที่ใหญ่และ font-weight ที่เบา Display Headings มี Class มาให้เลือก 4 Class ด้วยกัน คือ [color=#FF40BF].display-1, .display-2, .display-3, .display-4[/color]
ตัวอย่าง
[code]<!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>[/code]
[b][color=#FF0000]ผลลัพธ์[/color][/b]
[attachment=0]b2.JPG[/attachment]
[b]อ้างอิง [/b]: [url]https://www.w3schools.com/bootstrap4/bootstrap_typography.asp[/url]