预滚动 CSS 与后滚动不同



滑动工作小提琴,但在滚动之前宽度不正确。 布局正确,但此处没有滚动功能。 仍在学习 CSS,但出于某种原因,如果我删除 follwong 固定浮动侧 CSS:

#commentWrapper { 
  position: absolute;
  margin-left: 35px;
  left: 450px;
  width: 280px;
}
#comment {
  position: absolute;
  top: 0;
  /* Can include margins in the sliding effect here */
}
#comment.fixed {
  position: fixed;
  top: 0;
}
,该位置对于

侧面是正确的,但是当您向下滚动时,它不会停留在其固定位置。 保留代码,CSS 出于某种原因减少了边的宽度,但一旦向下滚动,它就会变得正常。 如何修复它,使其以正确的位置和宽度加载到侧面?

我更新了你的CSS。 看一看。 我希望这解决了您的问题!

我更改的相关代码:

新增功能:

#commentWrapper { 
float:right;
margin-left: 10px;
margin-right: 10px;
left: 450px;
width: 25%;
}

老:

#commentWrapper { 
    position: absolute;
    margin-left: 35px;
    left: 450px;
    width: 280px;
}

最新更新