scroll-margin-top: 3rem; /* 导航栏高度大约是 3rem */ } 这样,当页面滚动到商品 20 时,它会自动与导航栏保持一定的距离,不会被遮挡。 结语 通过使用scroll-margin-top属性,你可以轻松解决固定导航栏遮挡页面内容的问题。这对于用户体验至关重要,特别是在移动端设备上,用户对流畅的页面体验有更高的要求。希...
/* Shorthand */scroll-margin:{1,4};/* Longhands */scroll-margin-top:;scroll-margin-right:;scroll-margin-bottom:;scroll-margin-left:;/* inline-specific and block-specific properties as well */scroll-margin-block:{1,2}; scroll-margin-inline:{1,2}; ...
scroll-margin-left:0; } .scrolling-section2 { background-color: rgb(230, 173, 218); scroll-margin-left: 0; } .scrolling-section3 { background-color: rgb(119, 224, 210); scroll-margin-left: 0; } Scroll the content using the scrollbar arrows to see the effect. scroll-margin...
Learn about the scroll-margin-inline-end CSS Property. View description, syntax, values, examples and browser support for the scroll-margin-inline-end CSS Property.
scroll-margin-right属性用于一次将所有滚动边距设置到元素的右侧。为scroll-margin-right指定的值确定应该本质上保留在快照端口之外的页面数量。 因此,scroll-margin-right值表示定义了滚动捕捉区域的起始点,该区域用于将该框捕捉到捕捉端口。 用法: scroll-margin-right:length ...
scroll-margin:length /* Or */scroll-margin:Global_Values 属性值:这个性质接受two-properties上面提到并在下面描述: length:此属性引用以长度单位exp:px,em,vh等定义的值。 Global_Values:此属性引用全局值,例如Inherit,Initial,unset等。 注意:scroll-margin不接受百分比值作为长度。
69 - 118: Supported 119: Supported 120 - 122: Supported Safari 3.1 - 10.1: Not supported 11 - 14: Partial support 14.1 - 17.0: Supported 17.1: Supported 17.2 - TP: Supported Opera 10 - 55: Not supported 56 - 102: Supported 103: Supported ...
CSS property: scroll-margin Global usage 95.15% + 0.55% = 95.7% IE ❌ 6 - 10: Not supported ❌ 11: Not supported Edge ❌ 12 - 18: Not supported ✅ 79 - 133: Supported ✅ 134: Supported Firefox ❌ 2 - 67: Not supported ◐ 68 - 89: Partial support ✅ 90 - 136: ...
/* <length> values */scroll-margin-left:10px;scroll-margin-left:1em;/* Global values */scroll-margin-left:inherit;scroll-margin-left:initial;scroll-margin-left:unset; Values <length> An outset from the left edge of the scroll container. ...
它依赖于smooth-scrolljQuery脚本。此外,我在您的body中也没有看到scroll-behavior: smooth;(参见this ...