Tillitsdone
down Scroll to discover

CSS text-orientation Controlling Vertical Text Layouts

Learn how to use CSS text-orientation for vertical text layouts.

Discover available options like mixed, upright, and sideways for better text presentation.
thumbnail

Browser Compatibility

The text-orientation property is widely supported across modern web browsers, making it a reliable choice for creating vertical text layouts. Here’s a quick overview of browser compatibility:

Supported Browsers

  • Google Chrome: Supported since version 48.
  • Microsoft Edge: Supported since version 79.
  • Mozilla Firefox: Supported since version 41.
  • Opera: Supported since version 35.
  • Safari: Supported since version 14.

Compatibility Notes

  • The text-orientation property works best with the writing-mode property set to a vertical mode.
  • Ensure that you test your vertical text layouts across different browsers to catch any inconsistencies.

Browser Compatibility for text-orientation

  • Internet Explorer: The text-orientation property is not supported in Internet Explorer. If you need to support older browsers, consider using alternative solutions or fallbacks.
  • Mobile Browsers: The text-orientation property is well-supported in modern mobile browsers, making it easy to implement vertical text layouts on mobile devices.

Checking Browser Compatibility

To ensure your web project works with the text-orientation property, use browser compatibility tables and tools. These resources give you detailed information on CSS property support across different browsers and versions.

Example

You can use the following CSS to check the browser compatibility of the text-orientation property:

p {
writing-mode: vertical-rl; /* Set writing mode to vertical right-to-left */
text-orientation: mixed; /* Use the default value */
}

Ensuring Cross-Browser Compatibility

While the text-orientation property is widely supported, it’s always good to test your web pages across different browsers and devices to ensure consistent behavior. Here are some tips:

  1. Use Browser Compatibility Tables: Refer to resources like the Mozilla Developer Network (MDN) Web Docs for up-to-date information on browser support.
  2. Test on Multiple Browsers: Manually test your web pages on different browsers and versions to identify any compatibility issues.
  3. Implement Fallbacks: For older browsers that do not support the text-orientation property, consider implementing fallback solutions to maintain the desired text orientation.
  4. Use Polyfills: In some cases, polyfills can be used to add support for the text-orientation property in browsers that do not natively support it.

Formal Syntax

The text-orientation property in CSS follows a specific syntax that defines how text characters are oriented within a line. The formal syntax for this property is as follows:

text-orientation = mixed | upright | sideways

Explanation of Formal Syntax

  • mixed: This value rotates characters of horizontal scripts 90° clockwise and lays out characters of vertical scripts naturally. It is the default value.
  • upright: This value lays out characters of both horizontal and vertical scripts naturally (upright). It forces the text direction to be left-to-right.
  • sideways: This value lays out characters as they would be horizontally but rotates the entire line 90° clockwise.

Global Values

In addition to the specific keyword values, the text-orientation property also accepts global values that control inheritance and resetting of the property.

  • inherit: Inherits the value from the parent element.
  • initial: Sets the property to its default value.
  • revert: Resets the property to the value established by the user-agent stylesheet.
  • revert-layer: Resets the property to the value established by the user-agent stylesheet for the current cascade layer.
  • unset: Acts as either inherit or initial, depending on whether the property is inherited or not.

Example of Formal Syntax

Here is an example of how the formal syntax is used in CSS:

p {
writing-mode: vertical-rl; /* Set writing mode to vertical right-to-left */
text-orientation: mixed; /* Use the default value */
}

Understanding the Formal Syntax

The formal syntax of the text-orientation property provides a clear structure for defining the orientation of text characters. By following this syntax, web developers and designers can ensure that their vertical text layouts are consistent and readable. The syntax includes specific keyword values (mixed, upright, sideways) and global values (inherit, initial, revert, revert-layer, unset), giving developers the flexibility to control the text orientation according to their design requirements.

Understanding the formal syntax is crucial for effectively using the text-orientation property in web development and design. It ensures that the text is properly oriented and aligned, enhancing the overall user experience and accessibility of web pages.

See Also

To further enhance your understanding and usage of the text-orientation property, check out these related resources and properties:

Related CSS Properties

  • writing-mode: This property defines the writing mode of the text, which can be horizontal or vertical. It works in conjunction with text-orientation.
    • [MDN Web Docs: writing-mode]WebsiteUrl
  • text-combine-upright: This property allows characters to be displayed upright in a horizontal line within a vertical text layout. It is particularly useful for languages that use vertical scripts.
    • [MDN Web Docs: text-combine-upright]WebsiteUrl
  • unicode-bidi: This property controls the embedding and overriding levels for the Unicode bidirectional algorithm. It is useful for handling text direction in mixed-direction content.
    • [MDN Web Docs: unicode-bidi]WebsiteUrl

Additional Resources

  • CSS Logical Properties: Logical properties provide a way to write CSS that is independent of the writing mode and direction. They are useful for creating flexible and adaptable layouts.
    • [MDN Web Docs: CSS Logical Properties and Values]WebsiteUrl
  • Styling Vertical Text: This article provides an in-depth look at styling vertical text for Chinese, Japanese, Korean, and Mongolian languages.
    • [W3C: Styling vertical text]WebsiteUrl
  • Browser Support Test Results: Extensive browser support test results for the text-orientation property.
    • [W3C i18n Tests: text-orientation]WebsiteUrl

Conclusion

The text-orientation property is a powerful tool for web developers and designers working with vertical text layouts. By understanding its usage, values, and browser compatibility, you can create visually appealing and accessible web pages. Exploring related properties and resources will further enhance your ability to work with vertical scripts and create effective web designs.

icons/css-4.svg CSS Blogs
CSS3 is the latest version of Cascading Style Sheets, offering advanced styling features like animations, transitions, shadows, gradients, and responsive design.
icons/logo-tid.svg

Talk with CEO

Ready to bring your web/app to life or boost your team with expert Thai developers?
Contact us today to discuss your needs, and let’s create tailored solutions to achieve your goals. We’re here to help at every step!
🖐️ Contact us
Let's keep in Touch
Thank you for your interest in Tillitsdone! Whether you have a question about our services, want to discuss a potential project, or simply want to say hello, we're here and ready to assist you.
We'll be right here with you every step of the way.
Contact Information
rick@tillitsdone.com+66824564755
Find All the Ways to Get in Touch with Tillitsdone - We're Just a Click, Call, or Message Away. We'll Be Right Here, Ready to Respond and Start a Conversation About Your Needs.
Address
9 Phahonyothin Rd, Khlong Nueng, Khlong Luang District, Pathum Thani, Bangkok Thailand
Visit Tillitsdone at Our Physical Location - We'd Love to Welcome You to Our Creative Space. We'll Be Right Here, Ready to Show You Around and Discuss Your Ideas in Person.
Social media
Connect with Tillitsdone on Various Social Platforms - Stay Updated and Engage with Our Latest Projects and Insights. We'll Be Right Here, Sharing Our Journey and Ready to Interact with You.
We anticipate your communication and look forward to discussing how we can contribute to your business's success.
We'll be here, prepared to commence this promising collaboration.
Frequently Asked Questions
Explore frequently asked questions about our products and services.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.