First Public Working Draft · css-overscroll

CSS Overscroll Behavior

5 properties defined by this specification, all known to at least one browser .

Each feature in detail

overscroll-behavior

Property Limited availability Modern CSS: overscroll-behavior

MDN The overscroll-behavior CSS property controls what happens when scrolling reaches the edge of a scroll container.

Live preview Example from MDN
.example-container {
  width: 35em;
  height: 18em;
  border: medium dotted;
  padding: 0.75em;
  text-align: left;
  overflow: auto;
  display: flex;
}

.box {
  width: 50%;
}

#example-element {
  width: 50%;
  height: 12em;
  border: medium dotted #1b76c4;
  padding: 0.3em;
  margin: 0 0.3em;
  text-align: left;
  overflow: auto;
  overscroll-behavior: contain;
}

Syntax

[ contain | none | auto | chain ]{1,2}

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto auto
Applies to
scroll container elements
Inherited
no
Percentages
n/a
Computed value
see individual properties
Canonical order
per grammar
Animation type
discrete
Longhands
overscroll-behavior-x, overscroll-behavior-y

Browser support

First browser version supporting overscroll-behavior
Chrome 144
Edge 18
Firefox 150
Safari 16
Chrome Android 144
Safari iOS 16

First version with support, from MDN browser-compat-data.

overscroll-behavior-block

Property Limited availability Modern CSS: overscroll-behavior

MDN The overscroll-behavior-block CSS property sets the browser's behavior when the block direction boundary of a scrolling area is reached.

Live preview Example from MDN
main {
  height: 3000px;
  width: 500px;
  background-color: white;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 19px,
    rgb(0 0 0 / 50%) 20px
  );
}

main > div {
  height: 300px;
  width: 400px;
  overflow: auto;
  position: relative;
  top: 50px;
  left: 50px;
  overscroll-behavior-block: contain;
}

div > div {
  height: 1500px;
  width: 100%;
  background-color: yellow;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 19px,
    rgb(0 0 0 / 50%) 20px
  );
}

p {
  padding: 10px;
  background-color: rgb(255 0 0 / 50%);
  margin: 0;
  width: 340px;
  position: relative;
  top: 10px;
  left: 10px;
}

Syntax

contain | none | auto | chain

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto
Applies to
scroll container elements
Inherited
no
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting overscroll-behavior-block
Chrome 144
Edge 144
Firefox 150
Safari 16
Chrome Android 144
Safari iOS 16

First version with support, from MDN browser-compat-data.

overscroll-behavior-inline

Property Limited availability Modern CSS: overscroll-behavior

MDN The overscroll-behavior-inline CSS property sets the browser's behavior when the inline direction boundary of a scrolling area is reached.

Live preview Example from MDN
main {
  height: 400px;
  width: 3000px;
  background-color: white;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0px,
    transparent 19px,
    rgb(0 0 0 / 50%) 20px
  );
}

main > div {
  height: 300px;
  width: 400px;
  overflow: auto;
  position: relative;
  top: 50px;
  left: 50px;
  overscroll-behavior-inline: contain;
}

div > div {
  height: 100%;
  width: 1500px;
  background-color: yellow;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0px,
    transparent 19px,
    rgb(0 0 0 / 50%) 20px
  );
}

p {
  padding: 10px;
  background-color: rgb(255 0 0 / 50%);
  margin: 0;
  width: 360px;
  position: relative;
  top: 10px;
  left: 10px;
}

Syntax

contain | none | auto | chain

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto
Applies to
scroll container elements
Inherited
no
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting overscroll-behavior-inline
Chrome 144
Edge 144
Firefox 150
Safari 16
Chrome Android 144
Safari iOS 16

First version with support, from MDN browser-compat-data.

overscroll-behavior-x

Property Limited availability Modern CSS: overscroll-behavior

MDN The overscroll-behavior-x CSS property sets the browser's behavior when the horizontal boundary of a scrolling area is reached.

Syntax

contain | none | auto | chain

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto
Applies to
scroll container elements
Inherited
no
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting overscroll-behavior-x
Chrome 144
Edge 18
Firefox 150
Safari 16
Chrome Android 144
Safari iOS 16

First version with support, from MDN browser-compat-data.

overscroll-behavior-y

Property Limited availability Modern CSS: overscroll-behavior

MDN The overscroll-behavior-y CSS property sets the browser's behavior when the vertical boundary of a scrolling area is reached.

Syntax

contain | none | auto | chain

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto
Applies to
scroll container elements
Inherited
no
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting overscroll-behavior-y
Chrome 144
Edge 18
Firefox 150
Safari 16
Chrome Android 144
Safari iOS 16

First version with support, from MDN browser-compat-data.