ช่องว่างที่ไม่ตัดบรรทัด
U+00A0 ช่องว่างที่ป้องกันการขึ้นบรรทัดใหม่ที่ตำแหน่งนั้น HTML: ใช้ระหว่างตัวเลขและหน่วย (100 km) ในชื่อเฉพาะ (Mr. Smith) และหลังคำย่อ
What is a Non-Breaking Space?
The non-breaking space (NBSP) is a space character that looks identical to a regular space but has a special typographic and semantic property: it prevents the text rendering engine from inserting a line break at that position. When a line must wrap, it will break at a regular space — but never at a non-breaking space. The two characters around an NBSP stay together, always on the same line.
Unicode code point: U+00A0, encoded in UTF-8 as 0xC2 0xA0.
When to Use a Non-Breaking Space
The non-breaking space solves the problem of orphaned words and awkward breaks in specific text patterns:
| Use Case | Example | Without NBSP | With NBSP |
|---|---|---|---|
| Number + unit | 100 km |
"100" then "km" on next line | Always together |
| Title + name | Mr. Smith |
"Mr." alone at line end | Always together |
| Date parts | 25 January |
"25" alone | Always together |
| Currency | $1,000 |
May break oddly | Protected |
| Phone numbers | +1 800 555 |
Can break mid-number | Protected |
| French guillemets | « bonjour » |
Space before » might wrap |
Protected |
In French typography, non-breaking spaces are required before certain punctuation marks: :, ;, !, ?, » and after «. This is a strict typographic rule in French publishing.
Typing the Non-Breaking Space
- macOS: Option + Space
- Windows: Alt + 0160 (numpad), or Ctrl+Shift+Space in MS Word
- HTML:
(the most common HTML entity of all time) - CSS:
white-space: nowrapachieves a similar effect without the character itself
<!-- Keep "100" and "km" on the same line -->
100 km
<!-- French typography -->
Bonjour !
<!-- Non-breaking in a span -->
<span style="white-space: nowrap">Mr. Smith</span>
NBSP vs. CSS white-space
The non-breaking space character operates at the content level — it's part of the text. CSS white-space: nowrap operates at the presentation level — it prevents wrapping for an entire element. Choose based on the situation:
- Use
when the no-break relationship is semantic (a unit and its number belong together) - Use
white-space: nowrapwhen you want to prevent all wrapping in a UI element (like a navigation label) - Use
width: max-contentorflex-wrap: nowrapfor layout-level control
The Width Gotcha
Non-breaking spaces have the same visual width as regular spaces (in most fonts), but they behave differently in:
- Trimming: JavaScript
trim()does NOT remove NBSP. Usereplace(/[\s\u00A0]+/g, ' ')to normalize. - String splitting:
split(' ')on a string containing NBSP will not split at the NBSP position. - Regex:
\smatches NBSP in most engines, but[ ](literal space class) does not.
const s = "100\u00A0km";
console.log(s.trim()); // "100 km" — NBSP preserved
console.log(s.split(" ")); // ["100 km"] — no split at NBSP
console.log(s.split(/\s/)); // ["100", "km"] — \s matches NBSP
Quick Facts
| Property | Value |
|---|---|
| Unicode code point | U+00A0 |
| Unicode name | NO-BREAK SPACE |
| UTF-8 encoding | 0xC2 0xA0 (2 bytes) |
| HTML entity | |
| macOS shortcut | Option + Space |
| Windows shortcut | Alt + 0160 |
| Visual appearance | Identical to regular space |
| Line break behavior | Never breaks here |
| JavaScript trim() | Does NOT remove NBSP |
คำศัพท์ที่เกี่ยวข้อง
เพิ่มเติมใน การออกแบบตัวอักษร
CSS @font-face descriptor specifying which Unicode code points a font should cover. …
Em: ความกว้างเท่ากับขนาดฟอนต์ En: ครึ่งหนึ่งของ em ใช้กำหนดความกว้างของ em dash, em space, en space …
The mechanism by which a rendering engine substitutes glyphs from a secondary …
Modern font format developed by Microsoft and Adobe supporting up to 65,535 …
ทิศทางของข้อความที่อักขระไหลจากขวาไปซ้าย ใช้กับภาษาอาหรับ ฮีบรู Thaana และอักษรอื่นๆ ต้องใช้อัลกอริทึม Bidirectional เพื่อแสดงผลอย่างถูกต้อง
Fonts downloaded by the browser to render text, declared via CSS @font-face. …
การปรับระยะห่างระหว่างคู่อักขระเฉพาะเพื่อความสวยงามทางสายตา (เช่น AV, To, LT) เป็นคุณสมบัติของฟอนต์ ไม่ใช่แนวคิด Unicode แต่มีผลต่อการแสดงผลข้อความ Unicode
U+2026 HORIZONTAL ELLIPSIS (…) อักขระเดี่ยวที่แทนที่จุดสามจุด ถูกต้องตามหลักการพิมพ์และนับเป็น 1 อักขระแทนที่จะเป็น 3
รูปแบบตัวพิมพ์ใหญ่ที่มีความสูงเท่ากับตัวพิมพ์เล็ก CSS: font-variant: small-caps Unicode ยังมีตัวอักษรพิมพ์ใหญ่ขนาดเล็กจริงใน Latin Extended (ᴀ–ᴢ)
อักขระตั้งแต่สองตัวขึ้นไปที่รวมเข้าเป็น glyph เดียว อาจเป็นการเชื่อมแบบตัวพิมพ์ (fi → fi ผ่าน OpenType) หรืออักขระ Unicode (fi …