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

CSS overflow module #26425

Merged
merged 7 commits into from
Apr 28, 2023
Merged
Changes from 3 commits
Commits
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
66 changes: 55 additions & 11 deletions files/en-us/web/css/css_overflow/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,88 @@ spec-urls: https://drafts.csswg.org/css-overflow/#propdef-overflow

{{CSSRef}}

The **CSS Overflow** module contains the features of CSS relating to scrollable overflow handling in visual media. In CSS overflow happens when the content of a box extends past one or more of the box's edges.
The **CSS Overflow** module contains the features of CSS relating to scrollable overflow handling in visual media.
estelle marked this conversation as resolved.
Show resolved Hide resolved

## Ink overflow and scrollable overflow
CSS overflow happens when the content of a box extends past one or more of the box's edges. **Scrollable overflow** is content that appears outside of the box for which scrolling mechanisms need to be provided. The overflow properties are how we can control what happens when content overflows a box.
estelle marked this conversation as resolved.
Show resolved Hide resolved

There are two types of overflow that you might encounter in CSS. The first is described as **ink overflow**. This is the overflow of painting effects which do not affect layout or otherwise extend the scrollable overflow region, such as box shadows, border images, text decoration, overhanging glyphs, outlines, etc.
Painting effects that overflow content but do not participate in the CSS box model, also known as {{Glossary("ink overflow")}}, do not affect layout. Ink overflows, such as box shadows, border images, text decoration, overhanging glyphs, outlines, etc., do not extend the scrollable overflow region.
estelle marked this conversation as resolved.
Show resolved Hide resolved

The overflow that we sometimes need to manage in CSS is described as **scrollable overflow**. This is the content appearing outside of the box for which scrolling mechanisms need to be provided. The overflow properties are how we can control what happens when content overflows a box.
## Overflow in action

## Basic example
The following interactive example shows the effects of changing the value of the `overflow` property changes overflow of a fixed-size box. The example also includes options to change the `width` and `overflow-clip-margin` property values, as well as to programmatically scroll the content if the overflow property creates a {{Glossary("scroll container")}}.
estelle marked this conversation as resolved.
Show resolved Hide resolved

The following interactive example shows how changing the value of the `overflow` property, changes how the overflow of a fixed height box is dealt with.
{{EmbedGHLiveSample("css-examples/modules/overflow.html", '100%', 320)}}

{{EmbedInteractiveExample("pages/css/overflow.html")}}
A link is included in the preformatted lyrics to demonstrate the effects of keyboard focus on overflow and scroll behaviors. Try tabbing to the link or programmatically scrolling the content: the content will only scroll if the enumerated `<overflow>` value created a scroll container.
estelle marked this conversation as resolved.
Show resolved Hide resolved

## Reference

### CSS properties

- {{CSSxRef("overflow")}}
- {{CSSxRef("overflow-block")}}
- {{CSSxRef("overflow-inline")}}
- {{CSSxRef("overflow-x")}}
- {{CSSxRef("overflow-y")}}
- {{CSSxRef("overflow")}} shorthand
- {{CSSxRef("overflow-clip-margin")}}
- {{CSSxRef("scroll-behavior")}}
- {{CSSxRef("scrollbar-gutter")}}
- {{CSSxRef("text-overflow")}}
estelle marked this conversation as resolved.
Show resolved Hide resolved
- {{CSSxRef("block-overflow")}} {{experimental_inline}}
- {{CSSxRef("block-ellipsis")}} (formerly {{CSSxRef("block-overflow")}}) {{experimental_inline}}
estelle marked this conversation as resolved.
Show resolved Hide resolved
estelle marked this conversation as resolved.
Show resolved Hide resolved
estelle marked this conversation as resolved.
Show resolved Hide resolved
- {{CSSxRef("continue")}} {{experimental_inline}}
- {{CSSxRef("line-clamp")}} {{experimental_inline}}
- {{CSSxRef("max-lines")}} {{experimental_inline}}
- {{CSSxRef("continue")}} {{experimental_inline}}

### Non-standard properties

- {{CSSxRef("-webkit-line-clamp")}} {{non-standard_inline}}
Copy link
Contributor

Choose a reason for hiding this comment

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

This property is standardized in Level 4.


### Data types
Copy link
Contributor

Choose a reason for hiding this comment

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

How about this? 🙂

Suggested change
### Data types
### Enumerated values

Copy link
Member Author

@estelle estelle Apr 27, 2023

Choose a reason for hiding this comment

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

i want to keep it the same title as other landing pages (but feel free to commit if you disagree with me)

Copy link
Contributor

Choose a reason for hiding this comment

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

We can revisit this title if and when we do have the "Enumerated value types" category


- [`<overflow>`](/en-US/docs/Web/CSS/overflow_value) enumerated values

### Glossary

- {{Glossary("Scroll container")}}
- {{Glossary("Ink overflow")}}

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

- [Overflowing content](/en-US/docs/Learn/CSS/Building_blocks/Overflowing_content)
- : CSS building block: learn what overflow is and how to manage it.
- {{Experimental_Inline}} [Creating a named scroll timeline](/en-US/docs/Web/CSS/scroll-timeline-name#creating_a_named_scroll_timeline)
- : The CSS scroll timeline {{cssxref('scroll-timeline-name')}} and {{cssxref('scroll-timeline-axis')}} properties, along with the {{cssxref('scroll-timeline')}} shorthand, create animations tied to the scroll offset of a scroll container.

## Related concepts

- {{CSSxRef("scrollbar-width")}}
- {{CSSxRef("scrollbar-color")}}
estelle marked this conversation as resolved.
Show resolved Hide resolved
- {{CSSxRef("scroll-behavior")}} CSS property
- {{CSSxRef("scrollbar-gutter")}} CSS property
- {{cssxref("scroll-margin")}} CSS shorthand property
- {{cssxref("scroll-padding")}} CSS shorthand property
- {{cssxref("scroll-snap-align")}} CSS property
- {{cssxref("scroll-snap-stop")}} CSS property
- {{cssxref("scroll-snap-type")}} CSS property
- {{CSSxRef("::-webkit-scrollbar")}} pseudo-element
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role) ARIA role
- Element {{domxref("Element.scroll", "scroll()")}} method
- Element {{domxref("Element.scrollBy", "scrollBy()")}} method
- Element {{domxref("Element.scrollIntoView", "scrollIntoView()")}} method
- Element {{domxref("Element.scrollTo", "scrollTo()")}} method
- Element {{domxref("Element.scrollTop", "scrollTop")}} property
- Element {{domxref("Element.scrollLeft", "scrollLeft")}} property
- Element {{domxref("Element.scrollWidth", "scrollWidth")}} property
- Element {{domxref("Element.scrollHeight", "scrollHeight")}} property
- Document {{domxref("Document.scroll_event", "scroll")}} event

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

{{Specifications}}

## See also

- Properties for controlling the look of scrollbars {{CSSxRef("scrollbar-width")}} and {{CSSxRef("scrollbar-color")}}
- [CSS scrollbars styling module](/en-US/docs/Web/CSS/CSS_scrollbars)
estelle marked this conversation as resolved.
Show resolved Hide resolved
- [CSS scroll snap module](/en-US/docs/Web/CSS/CSS_Scroll_Snap)
- [CSS OM view module](/en-US/docs/Web/CSS/CSSOM_View)
estelle marked this conversation as resolved.
Show resolved Hide resolved
- How to [Debug scrollable overflow](https://firefox-source-docs.mozilla.org/devtools-user/page_inspector/how_to/debug_scrollable_overflow/index.html).