Skip to content

Revise text-indent property#43651

Open
estelle wants to merge 2 commits intomainfrom
estelle-patch-6
Open

Revise text-indent property#43651
estelle wants to merge 2 commits intomainfrom
estelle-patch-6

Conversation

@estelle
Copy link
Copy Markdown
Member

@estelle estelle commented Apr 2, 2026

Updated the text-indent documentation to include additional syntax examples, descriptions, and usage details. Added a description, clarifying the effects of percentage and negative values.

Updated the text-indent documentation to include additional syntax examples, descriptions, and usage details. Added a description, clarifying the effects of percentage and negative values.
@estelle estelle requested a review from a team as a code owner April 2, 2026 15:34
@estelle estelle requested review from hamishwillee and removed request for a team April 2, 2026 15:34
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs size/m [PR only] 51-500 LoC changed labels Apr 2, 2026
- : Indentation affects the first line of the block container as well as each line after a _forced line break_, but does not affect lines after a _soft wrap break_.
- `hanging`
- : Inverts which lines are indented. All lines _except_ the first line will be indented.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change


The `<length-percentage>` can be a positive or negative value. A negative value creates an outdent equal to the absolute value of the `<length-percentage>` equivalent positive value. A negative value effectively pushes the text the size of the value, but in the opposite direction. For example, `text-indent: 3%;` indents the first line of text , adding white space that is 3% of the container's inner-size before the text, pushing the first line of content toward the inline-end direction. Setting `text-indent: -3%` outdents the first line of text, pushing the start of the first line of text 3% of the container's inner-size past the inline-start of the content area, into the padding and border, possibly overflowing the containter.

A negative value is different from adding the `hanging` keyword to a positive value. Continuing with the same example, `text-indent: 3% hanging` doesn't outset the first line of text. Rather, it insets all the lines of text _except_ the first line, by 3% of the container's inner-size.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
A negative value is different from adding the `hanging` keyword to a positive value. Continuing with the same example, `text-indent: 3% hanging` doesn't outset the first line of text. Rather, it insets all the lines of text _except_ the first line, by 3% of the container's inner-size.
A negative value is different from adding the `hanging` keyword to a positive value. Continuing with the same example, `text-indent: 3% hanging` doesn't outset the first line of text. Rather, it insets all the lines of text _except_ the first line, by 3% of the container's inner-size.


#### CSS

Our use the `text-indent` property to indent the first line of each paragraph by `5em`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
Our use the `text-indent` property to indent the first line of each paragraph by `5em`.
Our use the `text-indent` property to indent the first line of each paragraph by `5em`.


#### CSS

We set the `text-indent` to a percentage value. We also added padding and vertical stripes to better enable guaging the size of the indentation relative to the element's box model.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
We set the `text-indent` to a percentage value. We also added padding and vertical stripes to better enable guaging the size of the indentation relative to the element's box model.
We set the `text-indent` to a percentage value. We also added padding and vertical stripes to better enable guaging the size of the indentation relative to the element's box model.

text-indent: 30%;

padding: 30px;
background-image: repeating-linear-gradient(to right, transparent 0 9.5%, #dedede 9.5% 10%);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
background-image: repeating-linear-gradient(to right, transparent 0 9.5%, #dedede 9.5% 10%);
background-image: repeating-linear-gradient(
to right,
transparent 0 9.5%,
#dedede 9.5% 10%
);

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Preview URLs (1 page)

(comment last updated: 2026-04-02 15:36:06)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:CSS Cascading Style Sheets docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants