react-code-diff icon indicating copy to clipboard operation
react-code-diff copied to clipboard

overflow使用时的问题

Open xpinus opened this issue 3 years ago • 0 comments

更改过多想要给盒子添加overflow: scroll的效果时发现,如果仅仅添加overflow那么左侧的数字框不会隐藏,需要添加position:relative属性,据我观察是因为行号的元素使用了absolute

<div className={styles.diffWraper}>
                <CodeDiff  />
</div>
.diffWraper {
  max-height: 400px;
  overflow-y: auto;
  position: relative;   // 必须有,否则出问题
}

xpinus avatar Jan 19 '22 06:01 xpinus