close
Skip to content

html: add examples for the dir global attribute - #45287

Merged
Josh-Cena merged 2 commits into
mdn:mainfrom
BHUVANSH855:add-dir-examples
Aug 28, 2026
Merged

html: add examples for the dir global attribute#45287
Josh-Cena merged 2 commits into
mdn:mainfrom
BHUVANSH855:add-dir-examples

Conversation

@BHUVANSH855

Copy link
Copy Markdown
Contributor

Description

Adds an ## Examples section to the dir global attribute page with four practical sub-examples covering all three attribute values, and adds the W3C bidi tutorial link to ## See also.

Motivation

The dir attribute page had no examples at all, making it hard for readers to understand when and how to use each value. The new examples show:

  • explicit ltr/rtl on paragraphs of different languages
  • dir="auto" for user-generated or unknown-language content
  • inline bidirectional text using <bdi> and <bdo>
  • setting document-level direction on the <html> element with per-element overrides

The W3C bidi tutorial link was also requested in the issue as a useful external reference.

Additional details

W3C tutorial linked in See also: https://www.w3.org/International/tutorials/bidi-xhtml/index.en.html

Related issues and pull requests

Fixes #44052

@github-actions github-actions Bot added Content:HTML Hypertext Markup Language docs size/m [PR only] 51-500 LoC changed labels Aug 22, 2026
@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Preview URLs (2 pages)

External URLs (1)

URL: /en-US/docs/Web/HTML/Reference/Global_attributes/dir
Title: dir HTML global attribute

(comment last updated: 2026-08-28 22:24:29)

@Josh-Cena
Josh-Cena marked this pull request as ready for review August 28, 2026 08:59
@Josh-Cena
Josh-Cena requested a review from a team as a code owner August 28, 2026 08:59
@Josh-Cena
Josh-Cena requested review from Josh-Cena and wbamberg and removed request for a team and wbamberg August 28, 2026 08:59

@Josh-Cena Josh-Cena left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I realize we don't do a good job saying what the dir attribute actually does (it sounds somewhat like it's just bdo), so I've added some description of the base direction.

@Josh-Cena
Josh-Cena merged commit da275ce into mdn:main Aug 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:HTML Hypertext Markup Language docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add examples for dir (possibly from W3C tutorials)

3 participants