CSS glyph-orientation-horizontal Property
The obsolete glyph-orientation-horizontal property was designed to control the orientation of individual glyphs in horizontally oriented SVG text.
It was introduced in SVG 1.1 as a way to specify glyph rotation using angle values. The property was later removed from SVG 2 and is not part of modern CSS text styling. It should not be used for new projects because browser support is limited and inconsistent. Modern SVG text can use the rotate attribute on the <text> or <tspan> element when individual glyph rotation is needed.
glyph-orientation-horizontal Syntax
The historical syntax accepted an angle value. The property applied to glyphs in horizontally oriented SVG text.
Basic Syntax
selector {
glyph-orientation-horizontal: 0deg;
}
Rotate Glyphs 90 Degrees
selector {
glyph-orientation-horizontal: 90deg;
}
Rotate Glyphs 180 Degrees
selector {
glyph-orientation-horizontal: 180deg;
}
SVG Text Selector
svg text {
glyph-orientation-horizontal: 45deg;
}
Historical CSS-Wide Keywords
.example {
glyph-orientation-horizontal: inherit;
}
.example {
glyph-orientation-horizontal: initial;
}
These examples illustrate the legacy syntax. Modern browsers may ignore the property entirely, so the declarations should not be relied upon for visible text rotation.
Property Values
The original SVG 1.1 definition used angle values to describe glyph orientation.
| Value | Historical Meaning |
|---|---|
0deg |
Displays glyphs at their normal horizontal orientation. |
90deg |
Specifies a quarter-turn rotation. |
180deg |
Specifies a half-turn rotation. |
270deg |
Specifies a three-quarter-turn rotation. |
<angle> |
Specifies an angle that was normalized to a value between 0 and 360 degrees for glyph orientation. |
inherit |
Uses the inherited value from the parent element. |
Historical Property Characteristics
| Characteristic | SVG 1.1 Definition |
|---|---|
| Initial value | 0deg |
| Inherited | Yes |
| Applies to | Text content elements in SVG |
| Value type | Angle |
| Percentage values | Not supported |
| Current status | Obsolete; removed from SVG 2 |
These characteristics describe the historical SVG 1.1 property, not a currently standardized CSS property.
How It Works
The property was intended to rotate glyphs relative to the normal horizontal text orientation.
Normal Glyph Orientation
svg text {
glyph-orientation-horizontal: 0deg;
}
A zero-degree angle represented the default glyph orientation.
Rotated Glyph Orientation
svg text {
glyph-orientation-horizontal: 90deg;
}
A 90-degree value requested rotation of individual glyphs rather than rotation of the entire SVG text element.
Text Layout
The original design allowed glyph orientation to change while text continued to participate in SVG text layout.
Modern Rendering
Current browser engines generally do not implement this obsolete property consistently. Unsupported declarations are ignored, leaving the text in its normal orientation.
Important Consideration
Do not confuse individual glyph orientation with rotating an entire text element. The two operations can produce substantially different layouts.
Historical Behavior
The glyph-orientation-horizontal property originated in SVG 1.1, which included properties for controlling the direction and orientation of SVG text.
SVG 1.1
The original specification defined horizontal and vertical glyph orientation properties separately.
Horizontal Text
The horizontal property controlled glyph orientation when text was laid out along a horizontal writing direction.
Vertical Text
The related glyph-orientation-vertical property controlled glyph orientation in vertically oriented SVG text.
SVG 2 Changes
SVG 2 removed the older glyph orientation properties and aligned SVG text styling more closely with CSS Writing Modes.
Modern CSS
Current implementations use properties such as writing-mode and text-orientation for writing direction and vertical text orientation.
Important Consideration
Legacy SVG files may still contain this property. Its presence does not mean that modern browsers will honor it.
Angle Values
The historical property accepted angles expressed in degrees and other CSS angle units.
Degrees
svg text {
glyph-orientation-horizontal: 45deg;
}
Radians
svg text {
glyph-orientation-horizontal: 1.5708rad;
}
Turns
svg text {
glyph-orientation-horizontal: 0.25turn;
}
Gradians
svg text {
glyph-orientation-horizontal: 100grad;
}
Angle Equivalents
| Degrees | Turns | Gradians |
|---|---|---|
0deg |
0turn |
0grad |
90deg |
0.25turn |
100grad |
180deg |
0.5turn |
200grad |
270deg |
0.75turn |
300grad |
360deg |
1turn |
400grad |
Important Consideration
Although these angle units are valid CSS angle representations, using them with the obsolete property does not guarantee browser support.
SVG Text
SVG supports text elements that can be positioned, styled, and transformed within a scalable graphic.
Basic SVG Text
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
<text x="20" y="60" font-size="32">SVG Text</text>
</svg>
Legacy Glyph Orientation
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
<text x="20" y="60" style="glyph-orientation-horizontal: 45deg;">
SVG Text
</text>
</svg>
This illustrates historical usage. The text may remain unrotated in modern browsers.
Modern SVG Text Rotation
<svg viewBox="0 0 300 120" xmlns="http://www.w3.org/2000/svg">
<text x="30" y="80" font-size="30" transform="rotate(-15 30 80)">
SVG Text
</text>
</svg>
The transform attribute rotates the entire text element around the specified point.
Important Consideration
Use modern SVG positioning and rotation features rather than relying on obsolete glyph orientation properties.
Horizontal vs. Vertical Orientation
SVG 1.1 defined separate properties for glyph orientation in horizontal and vertical writing directions.
Horizontal Orientation
svg text {
glyph-orientation-horizontal: 0deg;
}
The horizontal property was intended for glyphs in horizontally laid-out text.
Vertical Orientation
svg text {
glyph-orientation-vertical: auto;
}
The vertical property was intended for glyphs in vertically laid-out text and supported an auto value.
Different Initial Values
The historical initial value for glyph-orientation-horizontal was 0deg, while glyph-orientation-vertical used auto.
Modern Replacement
.vertical-text {
writing-mode: vertical-rl;
text-orientation: mixed;
}
Modern CSS separates writing direction from glyph orientation in vertical text.
Important Consideration
The modern text-orientation property is designed for vertical writing modes. It is not a direct replacement for arbitrary per-glyph rotation in horizontal text.
Modern Alternatives
Different modern features replace different aspects of the historical glyph orientation behavior.
| Goal | Recommended Feature |
|---|---|
| Rotate individual SVG glyphs | SVG rotate attribute |
| Rotate an entire text element | CSS transform or SVG transform attribute |
| Change text writing direction | CSS writing-mode |
| Control glyph orientation in vertical writing | CSS text-orientation |
| Position SVG characters individually | SVG <tspan> with positioning attributes |
Choosing an Alternative
Select the feature according to whether the goal is to rotate individual glyphs, rotate an entire element, or change the writing direction.
Important Consideration
No single modern CSS property duplicates every historical behavior of glyph-orientation-horizontal.
SVG rotate Attribute
The SVG rotate attribute can rotate individual characters within an SVG text element.
Rotate Individual Characters
<svg viewBox="0 0 320 120" xmlns="http://www.w3.org/2000/svg">
<text x="20" y="70" font-size="36" rotate="0 15 -15 0">
TEXT
</text>
</svg>
The angle list specifies rotations for successive characters in the SVG text.
Rotate a Single Character
<svg viewBox="0 0 320 120" xmlns="http://www.w3.org/2000/svg">
<text x="20" y="70" font-size="36">
A<tspan rotate="30">B</tspan>CD
</text>
</svg>
Multiple Rotations
<svg viewBox="0 0 320 120" xmlns="http://www.w3.org/2000/svg">
<text x="20" y="70" font-size="36" rotate="-10 10 -10 10">
WAVE
</text>
</svg>
Important Consideration
The SVG rotate attribute is distinct from the CSS rotate property. The SVG attribute can specify separate rotations for successive characters.
CSS transform Property
The CSS transform property can rotate an SVG text element or an HTML element as a whole.
Rotate an HTML Element
.rotated-label {
display: inline-block;
transform: rotate(-15deg);
}
Rotate SVG Text
svg .rotated-text {
transform: rotate(-15deg);
transform-box: fill-box;
transform-origin: center;
}
SVG Markup
<svg viewBox="0 0 300 120" xmlns="http://www.w3.org/2000/svg">
<text class="rotated-text" x="40" y="70" font-size="30">
Rotated Text
</text>
</svg>
Transform Origin
The transform-origin property controls the point around which an element rotates. SVG elements may also require transform-box to establish the intended reference box.
Important Consideration
CSS transforms rotate the entire selected element. They do not independently rotate each glyph inside a single text element.
CSS writing-mode Property
The writing-mode property controls whether text flows horizontally or vertically.
Horizontal Writing
.horizontal-text {
writing-mode: horizontal-tb;
}
Vertical Writing from Right to Left
.vertical-text {
writing-mode: vertical-rl;
}
Vertical Writing from Left to Right
.vertical-text {
writing-mode: vertical-lr;
}
SVG Example
<svg viewBox="0 0 200 180" xmlns="http://www.w3.org/2000/svg">
<text x="150" y="20" font-size="24" writing-mode="vertical-rl">
Vertical
</text>
</svg>
Important Consideration
Changing the writing mode affects text flow and layout. It does not provide arbitrary rotation angles for individual glyphs in horizontal text.
CSS text-orientation Property
The text-orientation property controls how glyphs are oriented when text uses a vertical writing mode.
Mixed Orientation
.vertical-text {
writing-mode: vertical-rl;
text-orientation: mixed;
}
The mixed value allows characters to use orientation behavior appropriate to their scripts.
Upright Orientation
.vertical-text {
writing-mode: vertical-rl;
text-orientation: upright;
}
The upright value displays characters upright in vertical text.
Sideways Orientation
.vertical-text {
writing-mode: vertical-rl;
text-orientation: sideways;
}
The sideways value displays text sideways within the vertical writing direction.
Important Consideration
The text-orientation property is intended for vertical writing modes and does not reproduce arbitrary horizontal glyph rotation.
Inheritance
Under SVG 1.1, glyph-orientation-horizontal was an inherited property.
Historical Parent Declaration
svg text {
glyph-orientation-horizontal: 30deg;
}
Historical Child Override
svg text {
glyph-orientation-horizontal: 30deg;
}
svg tspan {
glyph-orientation-horizontal: 0deg;
}
SVG Text Structure
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
<text x="20" y="60">
Parent <tspan>Child</tspan>
</text>
</svg>
In the historical model, a child text element inherited the parent's orientation unless it declared its own value.
Modern Behavior
Because the property is obsolete, modern browsers may ignore both the parent declaration and the child override.
Important Consideration
Do not rely on historical inheritance behavior when building new SVG text layouts.
glyph-orientation-horizontal Example
The original property is obsolete, so this example demonstrates the modern SVG rotate attribute as a reliable alternative for individual character rotation.
HTML Example
<div class="glyph-orientation-demo">
<svg viewBox="0 0 320 130" role="img" aria-label="SVG letters with individual rotations">
<text x="35" y="80" font-size="42" rotate="-15 15 -15 15">
TEXT
</text>
</svg>
</div>
CSS Example
.glyph-orientation-demo {
padding: 12px;
border: 1px solid #cccccc;
background-color: #f5f7fa;
}
.glyph-orientation-demo svg {
display: block;
width: 100%;
max-width: 320px;
height: auto;
}
.glyph-orientation-demo text {
fill: #2456a6;
font-family: Arial, sans-serif;
font-weight: bold;
}
Each character receives a separate rotation from the SVG rotate attribute. This produces a staggered appearance without rotating the entire text element.
Unlike the obsolete glyph-orientation-horizontal property, the SVG rotate attribute remains part of modern SVG text positioning.
Common Mistakes
Most problems involving glyph-orientation-horizontal result from treating an obsolete SVG property as a modern CSS feature.
Expecting Modern Browser Support
svg text {
glyph-orientation-horizontal: 90deg;
}
Modern browsers may ignore this declaration entirely.
Using the Property on HTML Text
p {
glyph-orientation-horizontal: 45deg;
}
The historical property was defined for SVG text, not ordinary HTML paragraphs.
Using a Percentage
svg text {
glyph-orientation-horizontal: 50%;
}
Percentages were not valid values for this property.
Using the auto Keyword
svg text {
glyph-orientation-horizontal: auto;
}
The horizontal property did not define auto as a value. That keyword belonged to the related vertical orientation property.
Confusing Glyph Rotation with Element Rotation
Rotating an entire text element with transform is not the same as rotating individual characters.
Using text-orientation in Horizontal Text
The modern text-orientation property is intended for vertical writing modes.
Assuming SVG 1.1 Features Remain Standardized
SVG 2 removed several older text properties. Review current SVG specifications before relying on legacy examples.
Ignoring Text Positioning
Individual character rotations can change the visual appearance of text without automatically providing additional space around each rotated glyph.
Using Legacy Properties in New Projects
Prefer the SVG rotate attribute, SVG transforms, or modern CSS writing-mode features according to the intended result.
Important Considerations
Keep the following points in mind when reviewing the obsolete glyph-orientation-horizontal property:
- Status: Obsolete and removed from SVG 2.
- Original purpose: Controlled glyph orientation in horizontal SVG text.
- Historical specification: SVG 1.1.
- Initial value:
0degin SVG 1.1. - Inheritance: Historically inherited.
- Value type: CSS angle.
- Degrees: Values such as
0deg,90deg, and180degdescribed rotation. - Percentages: Not supported.
- auto: Not a value of the horizontal property.
- HTML elements: The property was not intended for ordinary HTML text.
- Browser support: Limited and unreliable in modern browsers.
- SVG 2: Does not retain this property.
- Individual character rotation: Use the SVG
rotateattribute. - Whole-element rotation: Use CSS or SVG transforms.
- Writing direction: Use
writing-mode. - Vertical glyph orientation: Use
text-orientation. - Legacy files: Existing SVG documents may contain obsolete declarations.
- New projects: Avoid using
glyph-orientation-horizontal. - Accessibility: Ensure rotated text remains readable and does not overlap nearby content.
- Testing: Verify SVG text positioning and rendering in modern browsers.
The glyph-orientation-horizontal property is useful primarily when maintaining or interpreting older SVG content. For modern projects, use current SVG text positioning features and CSS writing-mode properties.
Browser Support
The obsolete glyph-orientation-horizontal property has Limited availability and is not reliably supported across modern browsers.
The property was defined in SVG 1.1 but removed from SVG 2. Modern browsers may ignore declarations using this property.
Legacy Declaration
svg text {
glyph-orientation-horizontal: 45deg;
}
Do not depend on this declaration for consistent rendering.
Recommended Alternative
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
<text x="20" y="65" font-size="32" rotate="0 15 -15 0">
TEXT
</text>
</svg>
The SVG rotate attribute is the preferred approach for individual character rotation in SVG text.
Browser Compatibility
For current compatibility information, visit Can I Use? and search for glyph-orientation-horizontal. Because the property is obsolete, a dedicated compatibility entry may not be available.
Specifications
The glyph-orientation-horizontal property was defined in SVG 1.1 as part of its text orientation features.
SVG 1.1: glyph-orientation-horizontal
SVG 2 removed the legacy glyph orientation properties and uses modern CSS writing-mode and text-orientation behavior.
For modern vertical text orientation, consult the CSS Writing Modes specification.
