如何在 HTML 中设置元素内容的文本方向?

htmlfront end technologyweb development更新于 2025/8/14 19:24:17

使用 HTML 中的 dir属性,可以设置元素内容的文本方向。您可以尝试运行以下代码来实现dir属性 −

示例

<!DOCTYPE html>
<html>
   <body>
      <p>This is demo text from left-to-right.</p>
      <p dir = "rtl">This is demo text from right-to-left.</p>
   </body>
</html>

相关文章


有用资源