Bootstrap ข้อความ/ตัวอักษร
การตั้งค่าเริ่มต้นของ Bootstrap
ขนาดแบบอักษรเริ่มต้นทั่วโลกของ Bootstrap คือ 14px โดยมีความสูงบรรทัดที่ 1.428
ใช้กับ<body>
องค์ประกอบและย่อหน้าทั้งหมด ( <p>
)
นอกจากนี้<p>
องค์ประกอบทั้งหมดมีระยะขอบด้านล่างที่เท่ากับครึ่งหนึ่งของความสูงบรรทัดที่คำนวณ (10px โดยค่าเริ่มต้น)
Bootstrap เทียบกับค่าเริ่มต้นของเบราว์เซอร์
ในบทนี้ เราจะดูองค์ประกอบ HTML บางอย่างที่ Bootstrap จะกำหนดสไตล์ให้แตกต่างไปจากค่าเริ่มต้นของเบราว์เซอร์เล็กน้อย
<h1> - <h6>
ตามค่าเริ่มต้น Bootstrap จะจัดรูปแบบส่วนหัว HTML ( <h1>
ถึง
<h6>
) ด้วยวิธีต่อไปนี้:
ตัวอย่าง
h1 Bootstrap heading (36px)
h2 Bootstrap heading (30px)
h3 Bootstrap heading (24px)
h4 Bootstrap heading (18px)
h5 Bootstrap heading (14px)
h6 Bootstrap heading (12px)
<เล็ก>
ใน Bootstrap <small>
องค์ประกอบ HTML ถูกใช้เพื่อสร้างข้อความรองที่เบากว่าในหัวข้อใด ๆ :
ตัวอย่าง
h1 heading secondary text
h2 heading secondary text
h3 heading secondary text
h4 heading secondary text
h5 heading secondary text
h6 heading secondary text
<mark>
Bootstrap จะจัดรูปแบบ<mark>
องค์ประกอบ HTML ในลักษณะต่อไปนี้:
ตัวอย่าง
Use the mark element to highlight text.
<abbr>
Bootstrap จะจัดรูปแบบ<abbr>
องค์ประกอบ HTML ในลักษณะต่อไปนี้:
ตัวอย่าง
The WHO was founded in 1948.
<blockquote>
Bootstrap จะจัดรูปแบบ<blockquote>
องค์ประกอบ HTML ในลักษณะต่อไปนี้:
ตัวอย่าง
For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
หากต้องการแสดงใบเสนอราคาทางด้านขวา ให้ใช้.blockquote-reverse
คลาส:
ตัวอย่าง
For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
<dl>
Bootstrap จะจัดรูปแบบ<dl>
องค์ประกอบ HTML ในลักษณะต่อไปนี้:
ตัวอย่าง
- Coffee
- - black hot drink
- Milk
- - white cold drink
<code>
Bootstrap จะจัดรูปแบบ<code>
องค์ประกอบ HTML ในลักษณะต่อไปนี้:
ตัวอย่าง
The following HTML elements: span
, section
, and div
defines a section in a document.
<kbd>
Bootstrap จะจัดรูปแบบ<kbd>
องค์ประกอบ HTML ในลักษณะต่อไปนี้:
ตัวอย่าง
Use ctrl + p to open the Print dialog box.
<pre>
Bootstrap จะจัดรูปแบบ<pre>
องค์ประกอบ HTML ในลักษณะต่อไปนี้:
ตัวอย่าง
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks.
สีและพื้นหลังตามบริบท
Bootstrap ยังมีคลาสตามบริบทบางอย่างที่สามารถใช้เพื่อให้ "ความหมายผ่านสี" ได้
คลาสสำหรับสีข้อความ ได้แก่.text-muted
,
.text-primary
, .text-success
, .text-info
,
.text-warning
, และ.text-danger
:
ตัวอย่าง
This text is muted.
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
คลาสสำหรับสีพื้นหลังคือ: .bg-primary
,
.bg-success
, .bg-info
, .bg-warning
, และ.bg-danger
:
ตัวอย่าง
This text is important.
This text indicates success.
This text represents some information.
This text represents a warning.
This text represents danger.
ชั้นเรียนวิชาการพิมพ์เพิ่มเติม
คลาส Bootstrap ด้านล่างสามารถเพิ่มให้กับองค์ประกอบ HTML ของสไตล์เพิ่มเติมได้:
Class | Description | Example |
---|---|---|
.lead |
Makes a paragraph stand out | |
.small |
Indicates smaller text (set to 85% of the size of the parent) | |
.text-left |
Indicates left-aligned text | |
.text-center |
Indicates center-aligned text | |
.text-right |
Indicates right-aligned text | |
.text-justify |
Indicates justified text | |
.text-nowrap |
Indicates no wrap text | |
.text-lowercase |
Indicates lowercased text | |
.text-uppercase |
Indicates uppercased text | |
.text-capitalize |
Indicates capitalized text | |
.initialism |
Displays the text inside an <abbr> element in a slightly smaller font size |
|
.list-unstyled |
Removes the default list-style and left margin on list items (works on both <ul> and <ol> ). This class only applies to immediate children list items (to remove the default list-style from any nested lists, apply this class to any nested lists as well) |
|
.list-inline |
Places all list items on a single line | |
.dl-horizontal |
Lines up the terms (<dt> ) and descriptions (<dd> ) in
<dl> elements side-by-side. Starts off like default <dl> s, but when the browser window expands, it will line up side-by-side |
|
.pre-scrollable |
Makes a <pre> element scrollable |
การอ้างอิงการพิมพ์ Bootstrap ที่สมบูรณ์
สำหรับข้อมูลอ้างอิงที่สมบูรณ์ขององค์ประกอบ/คลาสการพิมพ์ทั้งหมด ไปที่ Bootstrap Typography Reference ฉบับ สมบูรณ์ ของเรา
โปรด ดูที่Bootstrap Helper Classes Reference ของเรา สำหรับข้อมูลเพิ่มเติมเกี่ยวกับคลาสตามบริบท