我想<div>在网页上放置一个包含较长文本的元素,顶部间距固定为 30 像素。问题是,每当我向下滚动时,它们<div>就不会保持在原位,因此间距就会消失。我正在寻找仅 CSS 的解决方案。
该文档说明了我的问题:
<!DOCTYPE html>
<html>
<body>
<div style = "width: 10px; top: 50px; margin-top: 50px; padding-top: 50px;
position: absolute;">
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
text to enable scrolling.
</div>
</body>
</html>
慕标琳琳
慕田峪7331174
慕少森
慕尼黑8549860
相关分类