HTML Entity for Horizontal Bar (―)

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 1 Code Example
Unicode U+2015

What You'll Learn

How to display the Horizontal Bar (―) in HTML using hexadecimal, decimal, named entity, and CSS escape methods. This character is U+2015 (HORIZONTAL BAR) in the General Punctuation block (U+2000–U+206F).

Render it with ―, ―, ―, or CSS escape \2015. Use it for text breaks, separators, and typography in web design. It has a named HTML entity (―) for readable markup.

⚡ Quick Reference — Horizontal Bar

Unicode U+2015

General Punctuation

Hex Code ―

Hexadecimal reference

HTML Code ―

Decimal reference

Named Entity ―

Most readable option

Reference Table
Name           Value
────────────   ──────────
Unicode        U+2015
Hex code       ―
HTML code      ―
Named entity   ―
CSS code       \2015
Meaning        Horizontal bar (long dash)
CSS note       \2015 or \02015 in content property
1

Complete HTML Example

This example demonstrates the Horizontal Bar symbol (―) using hexadecimal code, decimal HTML code, the named entity, and a CSS content escape:

html
<!DOCTYPE html>
<html>
<head>
 <style>
  #point:after{
   content: "\2015";
  }
 </style>
</head>
<body>
<p>Horizontal Bar using Hexadecimal: &#x2015;</p>
<p>Horizontal Bar using Decimal: &#8213;</p>
<p>Horizontal Bar using Named Entity: &horbar;</p>
<p id="point">Horizontal Bar using CSS Entity: </p>
</body>
</html>
Try it Yourself

🌐 Browser Support

The Horizontal Bar (―) is supported in all modern browsers; most fonts include General Punctuation:

Chrome 1+
Firefox 1+
Safari 1+
Edge 12+
Opera 4+
Android 4.4+
iOS Safari 1+

👀 Live Preview

See the Horizontal Bar (―) in typography and separator contexts:

Large glyph
Named entity &horbar; renders as ―
Separator Part I ― Part II
vs em dash ― (horbar)   — (mdash)
Numeric refs &#x2015; &#8213; &horbar; \2015

🧠 How It Works

1

Hexadecimal Code

&#x2015; uses the Unicode hexadecimal value 2015 to display the symbol. The x prefix indicates hexadecimal format.

HTML markup
2

Decimal HTML Code

&#8213; uses the decimal Unicode value 8213 to display the same character.

HTML markup
3

Named Entity

&horbar; is the semantic named entity for ―—readable in source HTML and part of the HTML5 character set.

HTML markup
4

CSS Entity

\2015 is used in CSS stylesheets, particularly in the content property of pseudo-elements like ::before and ::after.

CSS stylesheet
=

Same visual result

All four methods produce the glyph: . Unicode U+2015 is in General Punctuation. Next: Horizontal Ellipsis.

Use Cases

The Horizontal Bar symbol (―) is commonly used in:

➖ Separators

Visual breaks between sections, paragraphs, or list items.

📰 Editorial

Article dividers, pull quotes, bylines, and editorial typography.

📄 Layout

Separate content blocks or simple horizontal rules in page design.

✎ Headings

Stylistic dashes in titles, captions, or headings.

📋 Lists & menus

Horizontal bars between menu items or list groups.

🎨 Branding

Logos, headers, and minimal design accents.

💡 Best Practices

Do

  • Use &horbar; for readable source markup
  • Most fonts support General Punctuation (U+2015); test on target devices
  • Keep one method (named, hex, or decimal) consistent across the document
  • For thematic breaks, consider <hr> styled with CSS; use ― for inline dashes
  • Serve pages with UTF-8 (<meta charset="utf-8">)

Don’t

  • Put CSS escape \2015 in HTML text nodes
  • Confuse ― with em dash &mdash; (U+2014) without checking typography needs
  • Use decorative bars without aria-hidden="true" when appropriate for screen readers
  • Rely on the symbol alone for screen reader users
  • Skip browser testing for math-heavy pages

Key Takeaways

1

Three HTML references plus CSS all render ―

&#x2015; &#8213; &horbar;
2

For CSS stylesheets, use the escape in the content property

\2015
3

Unicode U+2015 — HORIZONTAL BAR

4

Prefer &horbar; for readability in HTML source

❓ Frequently Asked Questions

Use &#x2015; (hex), &#8213; (decimal), &horbar; (named), or \2015 in CSS content. All produce ―.
U+2015 (HORIZONTAL BAR). General Punctuation block (U+2000–U+206F). Hex 2015, decimal 8213. Named entity: &horbar;.
For text breaks and separators, typography and editorial design, page or section dividers, stylistic dashes in headings, and any content that requires a horizontal bar or long dash character.
&horbar; is the named HTML entity for ―. It is part of the HTML5 named character set and the most readable option in source markup.
&horbar; is used directly in HTML content. The CSS escape \2015 (or \02015) belongs in stylesheets, typically in the content property of ::before or ::after. Both render ―.
The Horizontal Bar (―, U+2015) is often used as a quotation dash or separator. The em dash (—, U+2014) is typically used for punctuation breaks in sentences. Use &horbar; or &#x2015; for the horizontal bar and &mdash; or &#x2014; for the em dash.

Explore More HTML Entities!

Discover 1500+ HTML character references — punctuation, dashes, symbols, and more.

All HTML Entities →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful