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

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 62 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
114 changes: 114 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,114 @@
---
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. Certain elements are defined as **anchor elements**; **anchor-positioned** elements can then have their size and position set based on the size and location of the anchor elements to which they are bound.

In addition, the specification provides CSS-only mechanisms to:

- Specify a set of 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 positions instead.
- Declare conditions under which anchor-positioned elements should be hidden, in situations where it is not appropriate to tether them to anchor elements.

## 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
### Data types and values

- [`anchor-center`](/en-US/docs/Web/CSS/CSS_anchor_positioning/Using#centering_on_the_anchor_using_anchor-center)
estelle marked this conversation as resolved.
Show resolved Hide resolved
- [`<anchor-side>`](/en-US/docs/Web/CSS/anchor#anchor-side)
- [`<anchor-size>`](/en-US/docs/Web/CSS/anchor-size#anchor-size)
- [`<inset-area>`](/en-US/docs/Web/CSS/inset-area_value)
estelle marked this conversation as resolved.
Show resolved Hide resolved
- [`<try-side>`](/en-US/docs/Web/CSS/position-try-order#try-side)
- [`<try-tactic>`](/en-US/docs/Web/CSS/position-try-options#try-tactic)

### HTML attributes

- [`anchor`](/en-US/docs/Web/HTML/Global_attributes/anchor) {{non-standard_inline}}

### Interfaces

- {{domxref("CSSPositionTryDescriptors")}}
- {{domxref("CSSPositionTryRule")}}
- {{domxref("Element.anchorElement")}} {{non-standard_inline}}

## Guides

- [Using CSS anchor positioning](/en-US/docs/Web/CSS/CSS_anchor_positioning/Using)

- : An introductory guide to fundamental anchor positioning concepts, including associating, positioning, and sizing elements relative to their anchor.

- [Handling overflow: try options and conditional hiding](/en-US/docs/Web/CSS/CSS_anchor_positioning/Try_options_hiding)

- : A guide to the mechanisms CSS anchor positioning provides to prevent anchor-positioned elements from overflowing their containing elements or the viewport, including position try options and conditionally hiding elements.

## Related concepts

- [CSS logical properties and values](/en-US/docs/Web/CSS/CSS_logical_properties_and_values) module:
estelle marked this conversation as resolved.
Show resolved Hide resolved
- {{cssxref("inset-block-start")}}
chrisdavidmills marked this conversation as resolved.
Show resolved Hide resolved
- {{cssxref("inset-block-end")}}
- {{cssxref("inset-inline-start")}}
- {{cssxref("inset-inline-end")}}
- {{cssxref("inset-block")}}
- {{cssxref("inset-inline")}}
- {{cssxref("inset")}} shorthand
- {{cssxref("inline-size")}}
- {{cssxref("min-block-size")}}
- {{cssxref("min-inline-size")}}
- {{cssxref("max-block-size")}}
- {{cssxref("max-inline-size")}}
- [Inset properties](/en-US/docs/Glossary/Inset_properties) glossary term
- [CSS positioned layout](/en-US/docs/Web/CSS/CSS_positioned_layout) module:
- {{cssxref("top")}}
- {{cssxref("left")}}
- {{cssxref("bottom")}}
- {{cssxref("right")}}
- [CSS box model](/en-US/docs/Web/CSS/CSS_box_model) module:
- {{cssxref("width")}}
- {{cssxref("height")}}
- {{cssxref("min-width")}}
- {{cssxref("min-height")}}
- {{cssxref("max-width")}}
- {{cssxref("max-height")}}
- {{cssxref("block-size")}}
- [CSS box alignment](/en-US/docs/Web/CSS/CSS_box_alignment) module:
- {{cssxref("align-items")}}
- {{cssxref("align-self")}}
- {{cssxref("justify-items")}}
- {{cssxref("justify-self")}}
estelle marked this conversation as resolved.
Show resolved Hide resolved
- {{cssxref("place-items")}}
- {{cssxref("place-self")}}

## Specifications

{{Specifications}}

## See also

- [Learn: CSS positioning](/en-US/docs/Learn/CSS/CSS_layout/Positioning)
- [CSS logical properties and values](/en-US/docs/Web/CSS/CSS_logical_properties_and_values) module
- [Sizing items in CSS](/en-US/docs/Learn/CSS/Building_blocks/Sizing_items_in_CSS)