Skip to content

Conversation

@chrisdavidmills
Copy link
Contributor

Description

Firefox 146 adds support for CSS shape() relative control points, as used in <curve-command> and <smooth-command> commands, behind the layout.css.basic-shape-shape.enabled pref. See https://bugzilla.mozilla.org/show_bug.cgi?id=1921501, and in particular, this comment for some useful details.

This PR:

  • Adds entries to the Firefox 146 rel notes and Experimental features pages to detail the new availability.
  • Updates the shape() function reference page to improve the <curve-command> and <smooth-command> descriptions (making them easier to understand and adding details) and add some working examples.

Some notes:

  • I don't think we need to update the BCD. The Chromium and Safari data appears to be correct (they already support relative control points), and the Firefox data is also correct (it is all still supported only in preview, behind a pref, even though that support arrived in different versions). Let me know if you disagree.
  • Ideally, we should update this page to better organize the command descriptions and provide multiple examples of each of them in use. The function is really complex, so more guidance would be helpful. What I've done here is not perfect, but I think it does improve the coverage of the two commands in question, and allows me to link to them from the rel notes. I think a full page rewrite is out of scope for this PR.

Motivation

Additional details

Related issues and pull requests

@chrisdavidmills chrisdavidmills requested review from a team as code owners November 26, 2025 16:34
@chrisdavidmills chrisdavidmills requested review from estelle and pepelsbey and removed request for a team November 26, 2025 16:34
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs Content:Firefox Content in the Mozilla/Firefox subtree size/m [PR only] 51-500 LoC changed labels Nov 26, 2025
@github-actions
Copy link
Contributor

Preview URLs

Flaws (183)

Note! 2 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/CSS/Reference/Values/basic-shape/shape
Title: shape()
Flaw count: 183

  • broken_links:
    • /en-US/docs/Web/CSS/fill-rule is a redirect
    • /en-US/docs/Web/CSS/CSS_values_and_units/Value_definition_syntax#question_mark is a redirect
    • /en-US/docs/Web/CSS/CSS_values_and_units/Value_definition_syntax#hash_mark is a redirect
    • /en-US/docs/Web/CSS/CSS_values_and_units/Value_definition_syntax#single_bar is a redirect
    • /en-US/docs/Web/CSS/CSS_values_and_units/Value_definition_syntax#single_bar is a redirect
    • and 174 more flaws omitted
  • macros:
    • Macro produces link /en-US/docs/Web/CSS/position which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/position which is a redirect
    • Can't resolve /en-US/docs/Web/CSS/Guides/Logical_properties_and_values/Houdini
  • unknown:
    • page(Doc) not found /en-US/docs/Web/CSS/Guides/Scroll_driven_animations
External URLs (1)

URL: /en-US/docs/Mozilla/Firefox/Experimental_features
Title: Experimental features in Firefox

Copy link
Contributor

@dipikabh dipikabh left a comment

Choose a reason for hiding this comment

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

Thanks a lot @chrisdavidmills! It's looking really good.
Added a few suggestions for clarifying and simplifying some text. I can take another look after your updates.

Agree - BCD looks good as is.


#### Relative control points in CSS `shape()` curve commands

When specifying a [`<curve-command>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#curve-command) or [`<smooth-command>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#smooth-command) in a CSS `shape()` function, [`<relative-control-point>`]()s can be used to specify curve control points that are positioned relative to the start point of the current command, end point of the current command, or the top-left (origin) point of the container the shape is being drawn inside.
Copy link
Contributor

Choose a reason for hiding this comment

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

We could split this long sentence. Also turning it into active voice might help. How about:

Suggested change
When specifying a [`<curve-command>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#curve-command) or [`<smooth-command>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#smooth-command) in a CSS `shape()` function, [`<relative-control-point>`]()s can be used to specify curve control points that are positioned relative to the start point of the current command, end point of the current command, or the top-left (origin) point of the container the shape is being drawn inside.
You can use [`<relative-control-point>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#relative-control-point) values when specifying a [`<curve-command>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#curve-command) or [`<smooth-command>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#smooth-command) in a CSS `shape()` function. These values let you specify control points that are positioned relative to the start or end point of the current command, or relative to the origin (top-left) of the container the shape is being drawn inside.


### Symmetrical `letter-spacing`

The CSS {{cssxref("letter-spacing")}} property now splits the specified letter spacing evenly on both sides of each character. This is unlike the current behavior where spacing is added primarily to one side. This approach can improve text spacing, especially in mixed-directional text [Firefox bug 1891446](https://bugzil.la/1891446).
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to your update, spotted this tiny issue from earlier that could be fixed (parenthesis around the firefox bug):

Suggested change
The CSS {{cssxref("letter-spacing")}} property now splits the specified letter spacing evenly on both sides of each character. This is unlike the current behavior where spacing is added primarily to one side. This approach can improve text spacing, especially in mixed-directional text. ([Firefox bug 1891446](https://bugzil.la/1891446)).


- **Relative control points in CSS `shape()` curve commands**: `layout.css.basic-shape-shape.enabled`

When specifying a [`<curve-command>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#curve-command) or [`<smooth-command>`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape#smooth-command) in a CSS [`shape()`](/en-US/docs/Web/CSS/Reference/Values/basic-shape/shape) function, [`<relative-control-point>`]()s can be used to specify curve control points that are positioned relative to the start point of the current command, end point of the current command, or the top-left (origin) point of the container the shape is being drawn inside.
Copy link
Contributor

Choose a reason for hiding this comment

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

same updates can be applied here

- : Specifies a list of one or more comma-separated commands that define the shape, using syntax similar to [SVG path commands](/en-US/docs/Web/SVG/Reference/Attribute/d#path_commands). Commands include `<move-command>`, `<line-command>`, `<hv-line-command>`, `<curve-command>`, `<smooth-command>`, `<arc-command>`, and `close`. Each command's starting point is the previous command's ending point, with the first point of the shape defined by the [`from <coordinate-pair>`](#from_coordinate-pair) parameter.

The syntax of most shape commands is a keyword providing a directive, such as `move` or `line`, followed by the `by` or `to` keyword, and a set of coordinates.
#### Shape commands
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Thanks for collecting all this related content under a section

- If only a single `<control-point>` is provided, the command draws a [quadratic Bézier curve](/en-US/docs/Web/SVG/Reference/Attribute/d#quadratic_bézier_curve), which is defined by three points (the start point, control point, and end point).
- If two `<control-point>` values are provided, the command draws a cubic Bézier curve, which is defined by four points (the start point, two control points, and the end point).

Valid values for the `<end-point>` component:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Valid values for the `<end-point>` component:
Valid values for `<end-point>` include:

- : The control point is relative to the the top-left (origin) point of the container the shape is being drawn inside.

- `<smooth-command>`
- : Specified as `smooth [by | to] <end-point> [with <control-point>]`. This command adds a smooth [Bézier curve command](/en-US/docs/Web/SVG/Reference/Attribute/d#cubic_bézier_curve) to the list of shape commands. The `by` or `to` keyword determines whether the ending point of the curve, specified by the `<end-point>`, is relative or absolute, respectively.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- : Specified as `smooth [by | to] <end-point> [with <control-point>]`. This command adds a smooth [Bézier curve command](/en-US/docs/Web/SVG/Reference/Attribute/d#cubic_bézier_curve) to the list of shape commands. The `by` or `to` keyword determines whether the ending point of the curve, specified by the `<end-point>`, is relative or absolute, respectively.
- : Specified as `smooth [by | to] <end-point> [with <control-point>]`. This command adds a smooth [Bézier curve command](/en-US/docs/Web/SVG/Reference/Attribute/d#cubic_bézier_curve) to the list of shape commands. The `by` or `to` keyword determines whether the ending point of the curve, specified by the `<end-point>`, is relative or absolute.


{{EmbedLiveSample('Using shape() to define the visible part of an element', '100%', 300)}}

### Curve examples with relative control points
Copy link
Contributor

Choose a reason for hiding this comment

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

to make it similar in style to other example headings

Suggested change
### Curve examples with relative control points
### Using `shape()` to draw curves with relative control points


### Curve examples with relative control points

This example also uses {{cssxref("clip-path")}} to create different shapes for the clipping region of different elements. The shapes are specified using a combination of [`<curve-command>`](#curve-command) and [`<smooth-command>`](#smooth-command) , with [`<relative-control-point>`](#relative-control-point) values used for the control points. Note how some of the control points are relative to the start of the current curve, some are relative to the end of the current curve, and some are relative to the origin of the containing box.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of the "Note" sentence, can we add some more details to explain the three curves (similar to the description in other examples on the page)

Suggested change
This example also uses {{cssxref("clip-path")}} to create different shapes for the clipping region of different elements. The shapes are specified using a combination of [`<curve-command>`](#curve-command) and [`<smooth-command>`](#smooth-command) , with [`<relative-control-point>`](#relative-control-point) values used for the control points. Note how some of the control points are relative to the start of the current curve, some are relative to the end of the current curve, and some are relative to the origin of the containing box.
Like previous examples, this example also uses {{cssxref("clip-path")}} to create different shapes for the clipping regions of the elements. The shapes are specified using a combination of [`<curve-command>`](#curve-command) and [`<smooth-command>`](#smooth-command), and the control points are specified using [`<relative-control-point>`](#relative-control-point).
The first shape (`shape1`) uses control points that are relative to the start of the curve...

<div id="three"></div>
```

```css hidden live-sample___relative-control-points
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the @supports code to display the message when shape() is not supported?

Comment on lines +349 to +351
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

just for consistency with other examples on this page, can we call these shape1, shape2, and shape3?

@github-actions github-actions bot added the merge conflicts 🚧 [PR only] label Dec 2, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

This pull request has merge conflicts that must be resolved before it can be merged.

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 Content:Firefox Content in the Mozilla/Firefox subtree merge conflicts 🚧 [PR only] size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants