Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial review: CSS Anchor Positioning landing page and guide #33058

Merged
merged 70 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
9e31158
CSS Anchor Positioning landing page and tutorial
chrisdavidmills Apr 12, 2024
20bf5f6
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills Apr 15, 2024
8ec419d
first part of guide
chrisdavidmills Apr 15, 2024
b197523
Add anchor() example
chrisdavidmills Apr 17, 2024
4d0836d
Add description and example of inst-area
chrisdavidmills Apr 17, 2024
b6012eb
Another couple fo sections done
chrisdavidmills Apr 30, 2024
50dabaa
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills May 1, 2024
93204bc
Final content updates
chrisdavidmills May 3, 2024
3df35bc
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills May 3, 2024
3072147
Add inset-area() function to landing page
chrisdavidmills May 3, 2024
759020f
Merge branch 'css-anchor-positioning-1' of github.com:chrisdavidmills…
chrisdavidmills May 3, 2024
8b44357
Fixes for mfreed7 review comments
chrisdavidmills May 7, 2024
3a1eab2
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills May 7, 2024
0a64f95
Few more fixes for mfreed7 review comments
chrisdavidmills May 12, 2024
ee4f0c2
Update the position-try-order demo to use inset properties rather tha…
chrisdavidmills May 14, 2024
30de3ec
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills May 14, 2024
25b4efd
Remove position-try-order
chrisdavidmills May 15, 2024
998bcf1
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills May 15, 2024
a7f7f15
typo fix
chrisdavidmills May 15, 2024
0b17054
add back position-try-order
chrisdavidmills May 16, 2024
7a2a558
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills May 16, 2024
02b65b6
Update files/en-us/web/css/css_anchor_positioning/index.md
chrisdavidmills May 24, 2024
4ab329c
Update files/en-us/web/css/css_anchor_positioning/index.md
chrisdavidmills May 24, 2024
c704730
Update files/en-us/web/css/css_anchor_positioning/index.md
chrisdavidmills May 24, 2024
95abeca
Update files/en-us/web/css/css_anchor_positioning/index.md
chrisdavidmills May 24, 2024
f553a16
Update files/en-us/web/css/css_anchor_positioning/index.md
chrisdavidmills May 24, 2024
e6aaf4d
Update files/en-us/web/css/css_anchor_positioning/index.md
chrisdavidmills May 24, 2024
5b9fea7
Partial fixes; more to come
chrisdavidmills May 25, 2024
efc36f2
Fixes for estelle review comments
chrisdavidmills May 27, 2024
1237adf
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills May 27, 2024
b1a6a23
Update files/en-us/web/css/css_anchor_positioning/index.md
chrisdavidmills May 30, 2024
1d95627
Next round of fixes for estelle review comments
chrisdavidmills May 31, 2024
5affd38
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills May 31, 2024
319b01e
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills May 31, 2024
d90b1fb
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills May 31, 2024
febeb77
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills May 31, 2024
7df5a41
Update files/en-us/web/css/css_anchor_positioning/index.md
chrisdavidmills May 31, 2024
3c86b63
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills May 31, 2024
be3fa5c
change anchor name to be more distinct and less confusion
chrisdavidmills May 31, 2024
d9b0703
Split guide into two
chrisdavidmills Jun 4, 2024
e59c317
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills Jun 4, 2024
c6dd389
Added link to inset-area type
chrisdavidmills Jun 5, 2024
a8b9dee
fixes for estelle review comments
chrisdavidmills Jun 6, 2024
2e5fb62
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 6, 2024
27650a9
Update files/en-us/web/css/css_anchor_positioning/try_options_hiding/…
chrisdavidmills Jun 6, 2024
4a35de4
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 6, 2024
2f19e93
Update files/en-us/web/css/css_anchor_positioning/try_options_hiding/…
chrisdavidmills Jun 6, 2024
2dd3330
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 6, 2024
2d542f5
small terminology fix
chrisdavidmills Jun 6, 2024
3080bfe
module page suggestions
estelle Jun 7, 2024
8c9557b
Edits to the first guide
estelle Jun 8, 2024
1ba2c5a
update inset-area row and column values info
chrisdavidmills Jun 11, 2024
da5217c
Merge pull request #2 from mdn/ap1
chrisdavidmills Jun 11, 2024
1938693
Merge pull request #3 from mdn/ap1-guide1
chrisdavidmills Jun 11, 2024
f8dad40
a few fixes to make
chrisdavidmills Jun 11, 2024
32d6904
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 11, 2024
e716b52
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 15, 2024
c3d139f
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 15, 2024
856795c
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 15, 2024
51012ab
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 15, 2024
0897b72
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 15, 2024
ae88d9a
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 15, 2024
fd7befd
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 15, 2024
3b5e5b7
Update files/en-us/web/css/css_anchor_positioning/using/index.md
chrisdavidmills Jun 15, 2024
c580a57
Update files/en-us/web/css/css_anchor_positioning/using/inset-area.dr…
chrisdavidmills Jun 15, 2024
4072d32
Final fixes to using guide
chrisdavidmills Jun 15, 2024
60390c7
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills Jun 15, 2024
1898599
Add anchor() info to make association vs position clear, and clarify …
chrisdavidmills Jun 18, 2024
b9f13a5
Fixes for estelle review comments
chrisdavidmills Jun 19, 2024
b3a3905
Merge branch 'main' into css-anchor-positioning-1
chrisdavidmills Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions files/en-us/web/css/css_anchor_positioning/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: CSS anchor positioning
slug: Web/CSS/CSS_anchor_positioning
page-type: css-module
spec-urls: https://drafts.csswg.org/css-anchor-position-1/
---

{{CSSRef}}

The **CSS anchor positioning** module defines features that allow you to tether elements together — defining **anchor elements** and mechanisms by which other elements can be positioned and sized relative to them.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The **CSS anchor positioning** module defines features that allow you to tether elements together — defining **anchor elements** and mechanisms by which other elements can be positioned and sized relative to them.
The **CSS anchor positioning** module defines features that allow you to set the size and position of one element based on the size and location of an anchor element. This module provides the mechanisms for defining an element as an anchor element and positioning and sizing other elements based on that anchor.
The module provides CSS-only mechanisms for specifying alternative positions for an anchored element; when the default rendering position causes it to overflow its containing block and/or be rendered offscreen, the browser will try rendering the anchored element in the alternative position instead. This enables the placement of anchored elements relative to the anchor element regardless of location or size, relocating the anchored element to keep it within the viewport, or even hiding it, if appropriate, without any JavaScript.

reducing the reading level and coloquializing it to better help the reader comprehend the utility of the spec upfront.

If there's a good example, we can add a "see x module in action"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I don't agree with getting rid of tether — it is a precise word that describes perfectly what is going on. I think describing what is going on without using it will become really awkward if we have to do it everywhere tether is used, and will actually make the sentences more difficult to understand. I also concisely describe what is going on in the second sentence.

I have used some of your wording, where I think it improves things, and I have also provided a definition of tether in a note below the opening text. I suspect it will make sense to turn that into a glossary entry so we can link it everywhere tether is used. Let me know if you agree, and I will do that.


In addition, the specification provides mechanisms to:

- Declare conditions under which anchor-positioned elements should be hidden, to help in situations where it is not appropriate to tether them to anchor elements.
- Specify a set of alternative positions that the browser can try rendering the anchor-positioned element in, if the default rendering position causes it to overflow its containing block and/or be rendered offscreen.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
In addition, the specification provides mechanisms to:
- Declare conditions under which anchor-positioned elements should be hidden, to help in situations where it is not appropriate to tether them to anchor elements.
- Specify a set of alternative positions that the browser can try rendering the anchor-positioned element in, if the default rendering position causes it to overflow its containing block and/or be rendered offscreen.

moved this up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer it like this; I think your paragraph is a bit harder to read, as it is a big mass of text, plus you seem to miss out the information in the first bullet.

I have used some of your wording in the larger bullet, so I thought it improved on my original description. I also swapped the order of the bullets as the first one is more important.


## Reference
chrisdavidmills marked this conversation as resolved.
Show resolved Hide resolved

### Properties

- {{cssxref("anchor-name")}}
- {{cssxref("anchor-scope")}}
- {{cssxref("inset-area")}}
- {{cssxref("position-anchor")}}
- {{cssxref("position-try")}}
- {{cssxref("position-try-options")}}
- {{cssxref("position-try-order")}}
- {{cssxref("position-visibility")}}

### At-rules and descriptors

- {{cssxref("@position-try")}}
Copy link
Member

Choose a reason for hiding this comment

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

if the position-anchor and inset-area are used as descriptors, and not just CSS properties, put them here. (Haven't read that section. this comment may be ok to ignore)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They can be used as both CSS properties and descriptors. The thing is, there are about another 40 properties that can also be used as descriptors inside @position-try. Do we really need to list them all here? I feel like it would be confusing.

Copy link
Member

Choose a reason for hiding this comment

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

I'll let you know when i get to that page ;)


### Functions

- [`anchor()`](/en-US/docs/Web/CSS/anchor)
- [`anchor-size()`](/en-US/docs/Web/CSS/anchor-size)
- [`inset-area()`](/en-US/docs/Web/CSS/inset-area_function)

estelle marked this conversation as resolved.
Show resolved Hide resolved
### Interfaces

- {{domxref("CSSPositionTryRule")}}

## Guides

- [Using CSS anchor positioning](/en-US/docs/Web/CSS/CSS_anchor_positioning/Using)
- : A introductory guide to using all the features of the CSS Anchor Positioning specification.

## Related concepts

- Positioning properties that can take an [`anchor()`](/en-US/docs/Web/CSS/anchor) function as a value:
- The {{cssxref("top")}}, {{cssxref("left")}}, {{cssxref("bottom")}}, and {{cssxref("right")}} physical properties.
- The {{cssxref("inset-block-start")}}, {{cssxref("inset-block-end")}}, {{cssxref("inset-inline-start")}}, and {{cssxref("inset-inline-end")}} logical properties.
- The {{cssxref("inset-block")}}, {{cssxref("inset-inline")}}, and {{cssxref("inset")}} shorthand properties.
chrisdavidmills marked this conversation as resolved.
Show resolved Hide resolved
- Alignment properties that can take the `anchor-center` value:
- {{cssxref("align-items")}}
- {{cssxref("align-self")}}
- {{cssxref("justify-items")}}
- {{cssxref("justify-self")}}
estelle marked this conversation as resolved.
Show resolved Hide resolved
- Sizing properties that can take an [`anchor-size()`](/en-US/docs/Web/CSS/anchor) function as a value:
- The {{cssxref("width")}}, {{cssxref("height")}}, {{cssxref("min-width")}}, {{cssxref("min-height")}}, {{cssxref("max-width")}}, and {{cssxref("max-height")}} physical properties.
- The {{cssxref("block-size")}}, {{cssxref("inline-size")}}, {{cssxref("min-block-size")}}, {{cssxref("min-inline-size")}}, {{cssxref("max-block-size")}}, and {{cssxref("max-inline-size")}} logical properties.
chrisdavidmills marked this conversation as resolved.
Show resolved Hide resolved

### Non-standard features

- The HTML [`anchor`](/en-US/docs/Web/HTML/Global_attributes/anchor) attribute, which provides an alternative mechanism for associating positioned elements with anchor elements.
- The {{domxref("Element.anchorElement")}} property, which returns a reference to an positioned element's anchor element.
Copy link
Member

@estelle estelle May 17, 2024

Choose a reason for hiding this comment

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

Delete this section, and put the features in the standard template sections. i.e. put anchorElement under Interfaces, but as a sentence as a not on the bottom using https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_box_sizing as a template (there's a note there under properties and datatypes.) There's an example HTML attributes at https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_shadow_parts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, done.


> **Note:** The `anchor` attribute and the associated `anchorElement` property are currently disabled by default in supporting browsers. See the compatibility data on their linked reference pages for information on how to enable them for testing purposes.

## Specifications

{{Specifications}}

## See also

- [Positioning](/en-US/docs/Learn/CSS/CSS_layout/Positioning)
- [CSS logical properties and values](/en-US/docs/Web/CSS/CSS_logical_properties_and_values)
- [Sizing items in CSS](/en-US/docs/Learn/CSS/Building_blocks/Sizing_items_in_CSS)
chrisdavidmills marked this conversation as resolved.
Show resolved Hide resolved
Loading