Movatterモバイル変換


[0]ホーム

URL:


Menu
×
See More 
Sign In
+1 Get Certified Upgrade For Teachers Spaces Get Certified Upgrade For Teachers Spaces
   ❮   
     ❯   

CSS References

CSS ReferenceCSS Browser SupportCSS SelectorsCSS CombinatorsCSS Pseudo-classesCSS Pseudo-elementsCSS At-rulesCSS FunctionsCSS Reference AuralCSS Web Safe FontsCSS Fallback FontsCSS AnimatableCSS UnitsCSS PX-EM ConverterCSS ColorsCSS Color ValuesCSS Default ValuesCSS Entities

CSS Properties

accent-coloralign-contentalign-itemsalign-selfallanimationanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-functionaspect-ratiobackdrop-filterbackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackground-positionbackground-position-xbackground-position-ybackground-repeatbackground-sizeblock-sizeborderborder-blockborder-block-colorborder-block-endborder-block-end-colorborder-block-end-styleborder-block-end-widthborder-block-startborder-block-start-colorborder-block-start-styleborder-block-start-widthborder-block-styleborder-block-widthborder-bottomborder-bottom-colorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-styleborder-bottom-widthborder-collapseborder-colorborder-end-end-radiusborder-end-start-radiusborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-widthborder-inlineborder-inline-colorborder-inline-endborder-inline-end-colorborder-inline-end-styleborder-inline-end-widthborder-inline-startborder-inline-start-colorborder-inline-start-styleborder-inline-start-widthborder-inline-styleborder-inline-widthborder-leftborder-left-colorborder-left-styleborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-start-end-radiusborder-start-start-radiusborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottombox-decoration-breakbox-reflectbox-shadowbox-sizingbreak-afterbreak-beforebreak-insidecaption-sidecaret-color@charsetclearclipclip-pathcolorcolor-schemecolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumns@containercontentcounter-incrementcounter-resetcounter-set@counter-stylecursordirectiondisplayempty-cellsfilterflexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloatfont@font-facefont-familyfont-feature-settingsfont-kerning@font-palette-valuesfont-sizefont-size-adjustfont-stretchfont-stylefont-variantfont-variant-capsfont-weightgapgridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-startgrid-rowgrid-row-endgrid-row-startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rowshanging-punctuationheighthyphenshyphenate-characterimage-rendering@importinitial-letterinline-sizeinsetinset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-startisolationjustify-contentjustify-itemsjustify-self@keyframes@layerleftletter-spacingline-heightlist-stylelist-style-imagelist-style-positionlist-style-typemarginmargin-blockmargin-block-endmargin-block-startmargin-bottommargin-inlinemargin-inline-endmargin-inline-startmargin-leftmargin-rightmargin-topmarkermarker-endmarker-midmarker-startmaskmask-clipmask-compositemask-imagemask-modemask-originmask-positionmask-repeatmask-sizemask-typemax-block-sizemax-heightmax-inline-sizemax-width@mediamin-block-sizemin-inline-sizemin-heightmin-widthmix-blend-mode@namespaceobject-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-positionoffset-rotateopacityorderorphansoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-wrapoverflow-xoverflow-yoverscroll-behavioroverscroll-behavior-blockoverscroll-behavior-inlineoverscroll-behavior-xoverscroll-behavior-ypaddingpadding-blockpadding-block-endpadding-block-startpadding-bottompadding-inlinepadding-inline-endpadding-inline-startpadding-leftpadding-rightpadding-top@pagepage-break-afterpage-break-beforepage-break-insidepaint-orderperspectiveperspective-originplace-contentplace-itemsplace-selfpointer-eventsposition@propertyquotesresizerightrotaterow-gapscale@scopescroll-behaviorscroll-marginscroll-margin-blockscroll-margin-block-endscroll-margin-block-startscroll-margin-bottomscroll-margin-inlinescroll-margin-inline-endscroll-margin-inline-startscroll-margin-leftscroll-margin-rightscroll-margin-topscroll-paddingscroll-padding-blockscroll-padding-block-endscroll-padding-block-startscroll-padding-bottomscroll-padding-inlinescroll-padding-inline-endscroll-padding-inline-startscroll-padding-leftscroll-padding-rightscroll-padding-topscroll-snap-alignscroll-snap-stopscroll-snap-typescrollbar-colorshape-outside@starting-style@supportstab-sizetable-layouttext-aligntext-align-lasttext-decorationtext-decoration-colortext-decoration-linetext-decoration-styletext-decoration-thicknesstext-emphasistext-emphasis-colortext-emphasis-positiontext-emphasis-styletext-indenttext-justifytext-orientationtext-overflowtext-shadowtext-transformtext-underline-offsettext-underline-positiontoptransformtransform-origintransform-styletransitiontransition-delaytransition-durationtransition-propertytransition-timing-functiontranslateunicode-bidiuser-selectvertical-alignvisibilitywhite-spacewidowswidthword-breakword-spacingword-wrapwriting-modez-indexzoom



CSSscroll-padding-inline Property


Example

Set scroll padding in the inline direction to 20px from the container to the snap position:

div {
  scroll-padding-inline: 20px;
}
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

Thescroll-padding-inline property specifies the distance in the inline direction from the container to the snap position on the child elements.

This means that when you stop scrolling, the scrolling will quickly adjust and stop at a specified distance between the snap position and the container.

Inline direction is where the next character is put compared to the position of the existing characters in a line, and this is also how tags with CSSdisplay: inline; like <a> and <strong> tags are laid out in a text. Inline direction is dependent on the written language, i.e. Arabic where new charachters are laid out right to left which makes inline direction right to left, while pages in English have a left to right inline direction. Inline direction can be defined with CSS propertiesdirection andwriting-mode.

Snap position is the position on the child element where it snaps into place in the container when you stop scrolling.

Note: This property only works if the scroll-snap-align property is set to 'start' or 'end' for the inline direction.

Thescroll-padding-inline property is a shorthand property for the following properties:

Values for thescroll-padding-inline property can be set in different ways:

If the scroll-padding-inline property has two values:

  • scroll-padding-inline: 10px 50px;
    • distance at start is 10px
    • distance at end is 50px

If the scroll-padding-inline property has one value:

  • scroll-padding-inline: 10px;
    • distance at start and end is 10px

To see the effect from thescroll-padding-inline property, thescroll-snap-align property must be set on the child elements, and thescroll-padding-inline and thescroll-snap-type properties must be set on the parent element.

The CSSscroll-padding-block andscroll-padding-inline properties are very similar to CSS propertiesscroll-padding-top,scroll-padding-bottom,scroll-padding-left andscroll-padding-right, but thescroll-padding-block andscroll-padding-inline properties are dependent on block and inline directions.

Default value:auto
Inherited:no
Animatable:no.Read aboutanimatable
Version:CSS3
JavaScript syntax:object.style.scrollPaddingInline="20px"Try it

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
scroll-padding-inline69.079.068.015.056.0


CSS Syntax

scroll-padding-inline: auto|value|initial|inherit;

Property Values

ValueDescription
autoDefault value. The browser calculates the padding
lengthSpecifies scroll-padding-inline in px, pt, cm, etc. Negative values are not allowed.Read about length units
%Specifies the padding in percent of the width of the containing element
initialSets this property to its default value.Read aboutinitial
inheritInherits this property from its parent element.Read aboutinherit

More Examples

Image gallery

Thescroll-padding-inline property can be used in an image gallery with snap behaviour, to push images out from behind a fixed element:

#container {
  scroll-padding-inline: 30px 0;
}
Fixed
alleybridge in junglemountainsman with cameraCinque Terre
Try it Yourself »

Example

With thewriting-mode property value of the container element set to 'vertical-rl', the start of the container and child elements in the inline direction is moved from left side to top, and the end of the container and child elements is moved from right side to bottom. This affects the scroll snap behaviour, and how the scroll-padding-inline property works:

#container {
  scroll-padding-inline: 20px 0;
  writing-mode: vertical-rl;
}
Try it Yourself »

Example

With thedirection property value of the container element set to 'rtl', the start of the container and child elements in the inline direction is moved from the right side to the left side. This affects the scroll snap behaviour, and how the scroll-padding-inline property works:

#container {
  scroll-padding-inline: 20px 0;
  direction: rtl;
}
Try it Yourself »

Related Pages

CSS direction property:CSS Direction property

CSS scroll-snap-align property:CSS Scroll-snap-align property

CSS scroll-snap-type property:CSS Scroll-snap-type property

CSS writing-mode property:CSS Writing-mode property



×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted ourterms of use,cookies andprivacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved.W3Schools is Powered by W3.CSS.


[8]ページ先頭

©2009-2025 Movatter.jp