更改CSS弹性顺序会导致滚动 [英] Changing CSS flex order causes scrolling

查看:97
本文介绍了更改CSS弹性顺序会导致滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下HTML。它有两个标题和文章,以及一个切换它们出现顺序的按钮。

Consider the following HTML. It has two headers and articles, and a button that switches the order in which they appear.

按预期工作除非标题1隐藏一半(请参阅GIF),请稍微向下滚动。然后,当您按下按钮时,它会使窗口向下滚动,就像保持标题在视图中一样。

It works as expected unless "Header 1" is half hidden (see GIF) by scrolling slightly down. Then when you press the button it causes the window to scroll down, as if to keep the header in view.

这种情况发生在Chrome 74和Firefox 66上,但不会发生在Edge上。

This happens on Chrome 74 and Firefox 66, but not on Edge.

为什么会这样?有没有办法避免这种情况?

Why is this happening? And is there a way to avoid this?

const $ = document.querySelector.bind(document);
const div = $('div')
const button = $('button');

button.onclick = () => {
	div.classList.toggle('toggled')
}

div { display: flex }
div { flex-direction: column }

h1.first { order: 1 }
button { order: 2 }
div.first { order: 3 }
h1.second { order: 4 }
div.second { order: 5 }

.toggled h1.first {order: 4}
.toggled h1.second {order: 1}
.toggled div.first { order: 5 }
.toggled div.second { order: 3 }

<div id="div" >

  <h1 class="first">Header 1</h1>
  <h1 class="second">Header 2</h1>

  <button>Click me</button>

  <div class="first">
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
  </div>


  <div class="second">
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
  </div>

</div>

推荐答案

问题在于某些浏览器处理标题元素的方式。

The problem is the way some browsers treat header elements.

请注意,如果切换 h1 p 元素(只是将它们设置为标题),问题得到解决。

Note that if you switch the h1 to p elements (just style them as headers), the problem is resolved.

const $ = document.querySelector.bind(document);
const div = $('div')
const button = $('button');

button.onclick = () => {
	div.classList.toggle('toggled')
}

div { display: flex; }
div { flex-direction: column }

p.first { order: 1; font-size: 2em; }
button { order: 2 }
div.first { order: 3 }
p.second { order: 4; font-size: 2em; }
div.second { order: 5 }

.toggled h1.first {order: 4}
.toggled h1.second {order: 1}
.toggled div.first { order: 5 }
.toggled div.second { order: 3 }

<div id="div" >

  <p class="first">Header 1</p>
  <p class="second">Header 2</p>

  <button>Click me</button>

  <div class="first">
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
    This is the first box. This is the first box. This is the first box. This is the first box. 
  </div>


  <div class="second">
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
    This is the second box. This is the second box. This is the second box. This is the second box. 
  </div>

</div>

That said, you can override the behavior with the following code on the flex container:

That said, you can override the behavior with the following code on the flex container:

 overflow-anchor: none

This will disable a feature in the affected browsers known as \"scroll anchoring\".

This will disable a feature in the affected browsers known as "scroll anchoring".

More details here: Google Chrome viewport-anchored expand direction with flexbox

More details here: Google Chrome viewport-anchored expand direction with flexbox

这篇关于更改CSS弹性顺序会导致滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆