CSS CSS Tutorial CSS Advanced CSS Responsive Web Design(RWD) CSS Grid CSS Properties Sass Tutorial Sass Functions



text-orientation

CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in HTML (Hypertext Markup Language). CSS provides a wide range of properties to style the text and layout of a web page. One such property is text-orientation, which is used to define the orientation of the text within a block container.

The text-orientation property is used to specify the orientation of the characters in a block container. It is used to control the direction of the text flow, which can be either horizontal or vertical. The text-orientation property is supported by most modern web browsers, including Chrome, Firefox, Safari, and Edge.

The text-orientation property can take one of the following values:

  • mixed: This value is used to indicate that the text orientation is mixed, which means that some characters are displayed horizontally and some are displayed vertically.
  • upright: This value is used to indicate that the text is displayed in an upright orientation, which means that all characters are displayed horizontally.
  • sideways: This value is used to indicate that the text is displayed in a sideways orientation, which means that all characters are displayed vertically.
  • sideways-right: This value is used to indicate that the text is displayed in a sideways orientation, with the characters rotated 90 degrees clockwise.

Let's take a look at some examples of how to use the text-orientation property in CSS:

Example 1: Horizontal Text Orientation

In this example, we will set the text-orientation property to upright, which will display the text horizontally:

  <div style="text-orientation: upright;">
    This text will be displayed horizontally.
  </div>
  
This text will be displayed horizontally.

Example 2: Vertical Text Orientation

In this example, we will set the text-orientation property to sideways, which will display the text vertically:

  <div style="text-orientation: sideways;">
    This text will be displayed vertically.
  </div>
  
This text will be displayed vertically.

Example 3: Mixed Text Orientation

In this example, we will set the text-orientation property to mixed, which will display some characters horizontally and some characters vertically:

  <div style="text-orientation: mixed;">
    This text will be displayed with mixed orientation.
  </div>
  
This text will be displayed with mixed orientation.

Example 4: Sideways-Right Text Orientation

In this example, we will set the text-orientation property to sideways-right, which will display the text vertically with the characters rotated 90 degrees clockwise:

  <div style="text-orientation: sideways-right;">
    This text will be displayed vertically with characters rotated 90 degrees clockwise.
  </div>
  
This text will be displayed vertically with characters rotated 90 degrees clockwise.

As you can see from the examples above, the text-orientation property can be used to control the orientation of the text within a block container. This property is useful when you want to display text in a non-traditional orientation, such as vertically or with mixed orientation.

Conclusion

The text-orientation property is a useful CSS property that can be used to control the orientation of the text within a block container. This property is supported by most modern web browsers and can be used to display text in a non-traditional orientation, such as vertically or with mixed orientation.

References

Activity