- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我非常喜欢 css grid,因为它很简单。但是 flexbox 没有的 css grid 似乎存在性能问题。
我已经实现了一个两列全屏页面,两列都有一个带有输入框的表单和一个带有溢出-y:auto 的元素列表。一个使用 flexbox 实现左右面板的示例,以及使用 css grid 实现左右面板的一个示例。
这是 flexbox 版本:https://web-platform-wtfgmj.stackblitz.io/
这是 css 网格版本:https://web-platform-wtfgmj.stackblitz.io/index2.html
在 chrome 中打开开发者工具并启用绘画闪烁(必须启用工具/渲染)。
在输入框之一中键入时,css 网格版本将重新绘制列表中的所有元素。 flexbox 版本没有这个问题。
我想了解为什么 css grid 在输入框中键入时会重新绘制列表中的所有元素?它可以以某种方式避免吗?
更新:似乎是 stackblitz 的问题...
包含为代码片段
更新 2:因为它有点被评论所掩盖:
所以我用 chrome 提交了一个错误报告(bugs.chromium.org/p/chromium/issues/detail?id=1204446,根据 dgrogan 的建议),他们似乎确认这是 chrome 当前网格实现的性能问题。显然他们正忙于一个新的实现 LayoutNGGrid 来解决这个问题
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: "";
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: border-box;
box-shadow: none;
}
my-app {
display: flex;
flex-flow: column;
width: 100vw;
height: 100vh;
background-color: rgba(255, 0, 0, 0.1);
}
.header {
display: grid;
grid-template-columns: 3fr 7fr;
grid-template-rows: 1em;
gap: 0.6em;
align-items: flex-start;
margin: 1em;
}
.itemspanel {
display: flex;
flex: 1 1 auto;
flex-flow: column;
min-height: 0;
}
.itemheader {
flex: 0 0 auto;
}
.items {
flex: 1 1 auto;
display: flex;
flex-flow: column;
overflow-y: auto;
min-height: 0;
}
.itemrow {
display: flex;
flex-wrap: wrap;
padding-bottom: 1em;
}
.itemrow > span:nth-child(1) {
flex-basis: 30%;
flex-grow: 1;
}
.itemrow > span:nth-child(2) {
flex-basis: 70%;
flex-grow: 1;
}
.itemrowgrid {
display: grid;
grid-template-columns: 1fr 2fr;
padding: 0 0.5em 1em 0.5em;
}
.panels {
flex: 1 1 100%;
display: grid;
grid-template:
"left right" 1fr
/ 1fr 2fr;
gap: 1em;
min-height: 0;
}
.panelleft {
display: flex;
flex-flow: column;
grid-area: left;
min-height: 0;
}
.panelright {
display: flex;
flex-flow: column;
grid-area: right;
min-height: 0;
}
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<my-app ng-version="11.0.8">
<div class="panels">
<div class="panelleft">
<form novalidate="" name="frmFilters" autocomplete="off" class="header ng-valid ng-touched ng-dirty">
<label >Search:</label><input type="text" name="name" ng-reflect-name="name" ng-reflect-model="00000" class="ng-valid ng-touched ng-dirty"><label ></label><button type="button">Search</button>
</form>
<div class="itemspanel">
<div class="itemheader"></div>
<div class="items">
<div class="itemrowgrid"><span >Joelynn</span><span >Hitzmann</span></div>
<div class="itemrowgrid"><span >Farris</span><span >Espine</span></div>
<div class="itemrowgrid"><span >Linnet</span><span >Nare</span></div>
<div class="itemrowgrid"><span >Heidie</span><span >Coolican</span></div>
<div class="itemrowgrid"><span >Ulrike</span><span >Lowndsborough</span></div>
<div class="itemrowgrid"><span >Claudine</span><span >Caneo</span></div>
<div class="itemrowgrid"><span >Janella</span><span >Thurborn</span></div>
<div class="itemrowgrid"><span >Menard</span><span >Wolledge</span></div>
<div class="itemrowgrid"><span >Alasteir</span><span >Annandale</span></div>
<div class="itemrowgrid"><span >Isabelita</span><span >Byrom</span></div>
<div class="itemrowgrid"><span >Jim</span><span >Issard</span></div>
<div class="itemrowgrid"><span >Mic</span><span >Tiddeman</span></div>
<div class="itemrowgrid"><span >Carce</span><span >McClunaghan</span></div>
<div class="itemrowgrid"><span >Archibaldo</span><span >Jacqueme</span></div>
<div class="itemrowgrid"><span >Sybilla</span><span >Vivyan</span></div>
<div class="itemrowgrid"><span >Herve</span><span >Lund</span></div>
<div class="itemrowgrid"><span >Wade</span><span >Calway</span></div>
<div class="itemrowgrid"><span >Irita</span><span >Newvell</span></div>
<div class="itemrowgrid"><span >Lucie</span><span >Hurrion</span></div>
<div class="itemrowgrid"><span >Sherie</span><span >Bapty</span></div>
<div class="itemrowgrid"><span >Estella</span><span >Lettington</span></div>
<div class="itemrowgrid"><span >Lion</span><span >Ganforthe</span></div>
<div class="itemrowgrid"><span >Siouxie</span><span >January 1st</span></div>
<div class="itemrowgrid"><span >Clay</span><span >Knightsbridge</span></div>
<div class="itemrowgrid"><span >Shir</span><span >Desesquelle</span></div>
<div class="itemrowgrid"><span >Magda</span><span >Brew</span></div>
<div class="itemrowgrid"><span >Didi</span><span >Scanlon</span></div>
<div class="itemrowgrid"><span >Petr</span><span >Clerk</span></div>
<div class="itemrowgrid"><span >Frazier</span><span >Harler</span></div>
<div class="itemrowgrid"><span >Deonne</span><span >Scoffham</span></div>
<div class="itemrowgrid"><span >Meggi</span><span >Klampk</span></div>
<div class="itemrowgrid"><span >Darby</span><span >Huey</span></div>
<div class="itemrowgrid"><span >Berna</span><span >Batram</span></div>
<div class="itemrowgrid"><span >Ashli</span><span >Ducarel</span></div>
<div class="itemrowgrid"><span >Marilin</span><span >Gothup</span></div>
<div class="itemrowgrid"><span >Mariya</span><span >Fettis</span></div>
<div class="itemrowgrid"><span >Anett</span><span >Stookes</span></div>
<div class="itemrowgrid"><span >Adella</span><span >Wash</span></div>
<div class="itemrowgrid"><span >Ricky</span><span >Pellamonuten</span></div>
<div class="itemrowgrid"><span >Nora</span><span >Hourigan</span></div>
<div class="itemrowgrid"><span >Pancho</span><span >Wynn</span></div>
<div class="itemrowgrid"><span >Magdaia</span><span >Walthall</span></div>
<div class="itemrowgrid"><span >Thatch</span><span >Llorente</span></div>
<div class="itemrowgrid"><span >Margaretta</span><span >Ramiro</span></div>
<div class="itemrowgrid"><span >Jacques</span><span >Smallacombe</span></div>
<div class="itemrowgrid"><span >Gamaliel</span><span >Learoyd</span></div>
<div class="itemrowgrid"><span >Jyoti</span><span >Sholl</span></div>
<div class="itemrowgrid"><span >Elbertine</span><span >Larwell</span></div>
<div class="itemrowgrid"><span >Sebastian</span><span >Alvarado</span></div>
<div class="itemrowgrid"><span >Mart</span><span >Hentzeler</span></div>
</div>
</div>
</div>
<div class="panelright d2">
<form novalidate="" name="frmFilters" autocomplete="off" class="header ng-valid ng-dirty ng-touched">
<label >Search:</label><input type="text" name="name1" ng-reflect-name="name1" ng-reflect-model="0000" class="ng-valid ng-dirty ng-touched"><label ></label><button type="button">Search</button>
</form>
<div class="itemspanel">
<div class="itemheader"></div>
<div class="items">
<div class="itemrowgrid"><span >Joelynn</span><span >Hitzmann</span></div>
<div class="itemrowgrid"><span >Farris</span><span >Espine</span></div>
<div class="itemrowgrid"><span >Linnet</span><span >Nare</span></div>
<div class="itemrowgrid"><span >Heidie</span><span >Coolican</span></div>
<div class="itemrowgrid"><span >Ulrike</span><span >Lowndsborough</span></div>
<div class="itemrowgrid"><span >Claudine</span><span >Caneo</span></div>
<div class="itemrowgrid"><span >Janella</span><span >Thurborn</span></div>
<div class="itemrowgrid"><span >Menard</span><span >Wolledge</span></div>
<div class="itemrowgrid"><span >Alasteir</span><span >Annandale</span></div>
<div class="itemrowgrid"><span >Isabelita</span><span >Byrom</span></div>
<div class="itemrowgrid"><span >Jim</span><span >Issard</span></div>
<div class="itemrowgrid"><span >Mic</span><span >Tiddeman</span></div>
<div class="itemrowgrid"><span >Carce</span><span >McClunaghan</span></div>
<div class="itemrowgrid"><span >Archibaldo</span><span >Jacqueme</span></div>
<div class="itemrowgrid"><span >Sybilla</span><span >Vivyan</span></div>
<div class="itemrowgrid"><span >Herve</span><span >Lund</span></div>
<div class="itemrowgrid"><span >Wade</span><span >Calway</span></div>
<div class="itemrowgrid"><span >Irita</span><span >Newvell</span></div>
<div class="itemrowgrid"><span >Lucie</span><span >Hurrion</span></div>
<div class="itemrowgrid"><span >Sherie</span><span >Bapty</span></div>
<div class="itemrowgrid"><span >Estella</span><span >Lettington</span></div>
<div class="itemrowgrid"><span >Lion</span><span >Ganforthe</span></div>
<div class="itemrowgrid"><span >Siouxie</span><span >January 1st</span></div>
<div class="itemrowgrid"><span >Clay</span><span >Knightsbridge</span></div>
<div class="itemrowgrid"><span >Shir</span><span >Desesquelle</span></div>
<div class="itemrowgrid"><span >Magda</span><span >Brew</span></div>
<div class="itemrowgrid"><span >Didi</span><span >Scanlon</span></div>
<div class="itemrowgrid"><span >Petr</span><span >Clerk</span></div>
<div class="itemrowgrid"><span >Frazier</span><span >Harler</span></div>
<div class="itemrowgrid"><span >Deonne</span><span >Scoffham</span></div>
<div class="itemrowgrid"><span >Meggi</span><span >Klampk</span></div>
<div class="itemrowgrid"><span >Darby</span><span >Huey</span></div>
<div class="itemrowgrid"><span >Berna</span><span >Batram</span></div>
<div class="itemrowgrid"><span >Ashli</span><span >Ducarel</span></div>
<div class="itemrowgrid"><span >Marilin</span><span >Gothup</span></div>
<div class="itemrowgrid"><span >Mariya</span><span >Fettis</span></div>
<div class="itemrowgrid"><span >Anett</span><span >Stookes</span></div>
<div class="itemrowgrid"><span >Adella</span><span >Wash</span></div>
<div class="itemrowgrid"><span >Ricky</span><span >Pellamonuten</span></div>
<div class="itemrowgrid"><span >Nora</span><span >Hourigan</span></div>
<div class="itemrowgrid"><span >Pancho</span><span >Wynn</span></div>
<div class="itemrowgrid"><span >Magdaia</span><span >Walthall</span></div>
<div class="itemrowgrid"><span >Thatch</span><span >Llorente</span></div>
<div class="itemrowgrid"><span >Margaretta</span><span >Ramiro</span></div>
<div class="itemrowgrid"><span >Jacques</span><span >Smallacombe</span></div>
<div class="itemrowgrid"><span >Gamaliel</span><span >Learoyd</span></div>
<div class="itemrowgrid"><span >Jyoti</span><span >Sholl</span></div>
<div class="itemrowgrid"><span >Elbertine</span><span >Larwell</span></div>
<div class="itemrowgrid"><span >Sebastian</span><span >Alvarado</span></div>
<div class="itemrowgrid"><span >Mart</span><span >Hentzeler</span></div>
</div>
</div>
</div>
</div>
</my-app>
</body>
</html>
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: "";
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: border-box;
box-shadow: none;
}
my-app {
display: flex;
flex-flow: column;
width: 100vw;
height: 100vh;
background-color: rgba(255, 0, 0, 0.1);
}
.header {
display: grid;
grid-template-columns: 3fr 7fr;
grid-template-rows: 1em;
gap: 0.6em;
align-items: flex-start;
margin: 1em;
}
.itemspanel {
display: flex;
flex: 1 1 auto;
flex-flow: column;
min-height: 0;
}
.itemheader {
flex: 0 0 auto;
}
.items {
flex: 1 1 auto;
display: flex;
flex-flow: column;
overflow-y: auto;
min-height: 0;
}
.itemrow {
display: flex;
flex-wrap: wrap;
padding-bottom: 1em;
}
.itemrow > span:nth-child(1) {
flex-basis: 30%;
flex-grow: 1;
}
.itemrow > span:nth-child(2) {
flex-basis: 70%;
flex-grow: 1;
}
.itemrowgrid {
display: grid;
grid-template-columns: 1fr 2fr;
padding: 0 0.5em 1em 0.5em;
}
.panels {
flex: 1 1 100%;
display: flex;
flex-flow: row;
min-height: 0;
}
.panelleft,
.panelright {
display: flex;
flex-flow: column;
min-height: 0;
}
.panelleft {
flex: 1 1 100%;
}
.panelright {
flex: 1 1 200%;
}
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="reset.css">
<link rel="stylesheet" type="text/css" href="style1.css">
</head>
<body>
<my-app ng-version="11.0.8">
<div class="panels">
<div class="panelleft">
<form novalidate="" name="frmFilters" autocomplete="off" class="header ng-valid ng-touched ng-dirty">
<label >Search:</label><input type="text" name="name" ng-reflect-name="name" ng-reflect-model="00000" class="ng-valid ng-touched ng-dirty"><label ></label><button type="button">Search</button>
</form>
<div class="itemspanel">
<div class="itemheader"></div>
<div class="items">
<div class="itemrowgrid"><span >Joelynn</span><span >Hitzmann</span></div>
<div class="itemrowgrid"><span >Farris</span><span >Espine</span></div>
<div class="itemrowgrid"><span >Linnet</span><span >Nare</span></div>
<div class="itemrowgrid"><span >Heidie</span><span >Coolican</span></div>
<div class="itemrowgrid"><span >Ulrike</span><span >Lowndsborough</span></div>
<div class="itemrowgrid"><span >Claudine</span><span >Caneo</span></div>
<div class="itemrowgrid"><span >Janella</span><span >Thurborn</span></div>
<div class="itemrowgrid"><span >Menard</span><span >Wolledge</span></div>
<div class="itemrowgrid"><span >Alasteir</span><span >Annandale</span></div>
<div class="itemrowgrid"><span >Isabelita</span><span >Byrom</span></div>
<div class="itemrowgrid"><span >Jim</span><span >Issard</span></div>
<div class="itemrowgrid"><span >Mic</span><span >Tiddeman</span></div>
<div class="itemrowgrid"><span >Carce</span><span >McClunaghan</span></div>
<div class="itemrowgrid"><span >Archibaldo</span><span >Jacqueme</span></div>
<div class="itemrowgrid"><span >Sybilla</span><span >Vivyan</span></div>
<div class="itemrowgrid"><span >Herve</span><span >Lund</span></div>
<div class="itemrowgrid"><span >Wade</span><span >Calway</span></div>
<div class="itemrowgrid"><span >Irita</span><span >Newvell</span></div>
<div class="itemrowgrid"><span >Lucie</span><span >Hurrion</span></div>
<div class="itemrowgrid"><span >Sherie</span><span >Bapty</span></div>
<div class="itemrowgrid"><span >Estella</span><span >Lettington</span></div>
<div class="itemrowgrid"><span >Lion</span><span >Ganforthe</span></div>
<div class="itemrowgrid"><span >Siouxie</span><span >January 1st</span></div>
<div class="itemrowgrid"><span >Clay</span><span >Knightsbridge</span></div>
<div class="itemrowgrid"><span >Shir</span><span >Desesquelle</span></div>
<div class="itemrowgrid"><span >Magda</span><span >Brew</span></div>
<div class="itemrowgrid"><span >Didi</span><span >Scanlon</span></div>
<div class="itemrowgrid"><span >Petr</span><span >Clerk</span></div>
<div class="itemrowgrid"><span >Frazier</span><span >Harler</span></div>
<div class="itemrowgrid"><span >Deonne</span><span >Scoffham</span></div>
<div class="itemrowgrid"><span >Meggi</span><span >Klampk</span></div>
<div class="itemrowgrid"><span >Darby</span><span >Huey</span></div>
<div class="itemrowgrid"><span >Berna</span><span >Batram</span></div>
<div class="itemrowgrid"><span >Ashli</span><span >Ducarel</span></div>
<div class="itemrowgrid"><span >Marilin</span><span >Gothup</span></div>
<div class="itemrowgrid"><span >Mariya</span><span >Fettis</span></div>
<div class="itemrowgrid"><span >Anett</span><span >Stookes</span></div>
<div class="itemrowgrid"><span >Adella</span><span >Wash</span></div>
<div class="itemrowgrid"><span >Ricky</span><span >Pellamonuten</span></div>
<div class="itemrowgrid"><span >Nora</span><span >Hourigan</span></div>
<div class="itemrowgrid"><span >Pancho</span><span >Wynn</span></div>
<div class="itemrowgrid"><span >Magdaia</span><span >Walthall</span></div>
<div class="itemrowgrid"><span >Thatch</span><span >Llorente</span></div>
<div class="itemrowgrid"><span >Margaretta</span><span >Ramiro</span></div>
<div class="itemrowgrid"><span >Jacques</span><span >Smallacombe</span></div>
<div class="itemrowgrid"><span >Gamaliel</span><span >Learoyd</span></div>
<div class="itemrowgrid"><span >Jyoti</span><span >Sholl</span></div>
<div class="itemrowgrid"><span >Elbertine</span><span >Larwell</span></div>
<div class="itemrowgrid"><span >Sebastian</span><span >Alvarado</span></div>
<div class="itemrowgrid"><span >Mart</span><span >Hentzeler</span></div>
</div>
</div>
</div>
<div class="panelright d2">
<form novalidate="" name="frmFilters" autocomplete="off" class="header ng-valid ng-dirty ng-touched">
<label >Search:</label><input type="text" name="name1" ng-reflect-name="name1" ng-reflect-model="0000" class="ng-valid ng-dirty ng-touched"><label ></label><button type="button">Search</button>
</form>
<div class="itemspanel">
<div class="itemheader"></div>
<div class="items">
<div class="itemrowgrid"><span >Joelynn</span><span >Hitzmann</span></div>
<div class="itemrowgrid"><span >Farris</span><span >Espine</span></div>
<div class="itemrowgrid"><span >Linnet</span><span >Nare</span></div>
<div class="itemrowgrid"><span >Heidie</span><span >Coolican</span></div>
<div class="itemrowgrid"><span >Ulrike</span><span >Lowndsborough</span></div>
<div class="itemrowgrid"><span >Claudine</span><span >Caneo</span></div>
<div class="itemrowgrid"><span >Janella</span><span >Thurborn</span></div>
<div class="itemrowgrid"><span >Menard</span><span >Wolledge</span></div>
<div class="itemrowgrid"><span >Alasteir</span><span >Annandale</span></div>
<div class="itemrowgrid"><span >Isabelita</span><span >Byrom</span></div>
<div class="itemrowgrid"><span >Jim</span><span >Issard</span></div>
<div class="itemrowgrid"><span >Mic</span><span >Tiddeman</span></div>
<div class="itemrowgrid"><span >Carce</span><span >McClunaghan</span></div>
<div class="itemrowgrid"><span >Archibaldo</span><span >Jacqueme</span></div>
<div class="itemrowgrid"><span >Sybilla</span><span >Vivyan</span></div>
<div class="itemrowgrid"><span >Herve</span><span >Lund</span></div>
<div class="itemrowgrid"><span >Wade</span><span >Calway</span></div>
<div class="itemrowgrid"><span >Irita</span><span >Newvell</span></div>
<div class="itemrowgrid"><span >Lucie</span><span >Hurrion</span></div>
<div class="itemrowgrid"><span >Sherie</span><span >Bapty</span></div>
<div class="itemrowgrid"><span >Estella</span><span >Lettington</span></div>
<div class="itemrowgrid"><span >Lion</span><span >Ganforthe</span></div>
<div class="itemrowgrid"><span >Siouxie</span><span >January 1st</span></div>
<div class="itemrowgrid"><span >Clay</span><span >Knightsbridge</span></div>
<div class="itemrowgrid"><span >Shir</span><span >Desesquelle</span></div>
<div class="itemrowgrid"><span >Magda</span><span >Brew</span></div>
<div class="itemrowgrid"><span >Didi</span><span >Scanlon</span></div>
<div class="itemrowgrid"><span >Petr</span><span >Clerk</span></div>
<div class="itemrowgrid"><span >Frazier</span><span >Harler</span></div>
<div class="itemrowgrid"><span >Deonne</span><span >Scoffham</span></div>
<div class="itemrowgrid"><span >Meggi</span><span >Klampk</span></div>
<div class="itemrowgrid"><span >Darby</span><span >Huey</span></div>
<div class="itemrowgrid"><span >Berna</span><span >Batram</span></div>
<div class="itemrowgrid"><span >Ashli</span><span >Ducarel</span></div>
<div class="itemrowgrid"><span >Marilin</span><span >Gothup</span></div>
<div class="itemrowgrid"><span >Mariya</span><span >Fettis</span></div>
<div class="itemrowgrid"><span >Anett</span><span >Stookes</span></div>
<div class="itemrowgrid"><span >Adella</span><span >Wash</span></div>
<div class="itemrowgrid"><span >Ricky</span><span >Pellamonuten</span></div>
<div class="itemrowgrid"><span >Nora</span><span >Hourigan</span></div>
<div class="itemrowgrid"><span >Pancho</span><span >Wynn</span></div>
<div class="itemrowgrid"><span >Magdaia</span><span >Walthall</span></div>
<div class="itemrowgrid"><span >Thatch</span><span >Llorente</span></div>
<div class="itemrowgrid"><span >Margaretta</span><span >Ramiro</span></div>
<div class="itemrowgrid"><span >Jacques</span><span >Smallacombe</span></div>
<div class="itemrowgrid"><span >Gamaliel</span><span >Learoyd</span></div>
<div class="itemrowgrid"><span >Jyoti</span><span >Sholl</span></div>
<div class="itemrowgrid"><span >Elbertine</span><span >Larwell</span></div>
<div class="itemrowgrid"><span >Sebastian</span><span >Alvarado</span></div>
<div class="itemrowgrid"><span >Mart</span><span >Hentzeler</span></div>
</div>
</div>
</div>
</div>
</my-app>
</body>
</html>
最佳答案
我已经能够在本地重现该问题(至少)。正如您在下图中所看到的,在我的浏览器 (Chromium v92.0.4488.0) 中,仅重绘了列最右侧的区域 - 正是使用滚动条时将显示的区域。
另一方面,使用 Firefox (v88.0) 或 Safari (v14.0.3),在 Flexbox 和网格示例中,除了输入之外的任何内容都不会被重新绘制。
由于您不使用容器高度的绝对值,我怀疑这是由于高度的计算以及是否需要显示滚动条而发生的。 Chrome 在这里的行为似乎与其他浏览器不同。
一个简单的解决方法似乎是为容器定义一个绝对高度(vh,虽然它是一个 relative unit ,但似乎也有效):
.panelleft,
.panelright {
height: 100vh;
}
关于html - css 网格与 flexbox : why does css grid cause repaints and flexbox not,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67156643/
我每秒收到数百个事件,持续几秒钟,每个事件都会更新我的模型。如果我在每个事件之后在 invokeLater() 内部调用 repaint() ,那么 repaint 每秒会被调用数百次吗?它是否足够聪
我在类collection中有一个循环,它repaint() JPanel连续 while(loop) { imageicon = (ImageIcon) ois.readOb
我仍在尝试让一个 repaint() 方法在一个单独的类中工作,该类具有一个扩展 JComponent 的类。我已经在这里发布了几篇文章,但到目前为止我还无法让代码正常工作。我得到了一些很好的建议。我
谁能解释一下JPanel.repaint() 方法和JFrame.repaint() 方法之间的区别,我想两者都调用了paintComponent() JPanel 中的方法。 请说明,谢谢 最佳答案
在repaint(long maxDelay)(来自java.awt.Component)中,maxDelay指定之前可以经过的最大毫秒数调用update。 普通的repaint()有这样的最大值吗?
这个问题是基于我不久前遇到的一个简单的 Swing 骰子程序问题。我发布的原始问题是 here并且有一个可接受的答案,但我想确切地知道发生了什么,为什么会出现问题,以及解决方案为什么有效。 我设法削减
我正在为错误程序编写一个插件,并且在使用 repaint() 方法时遇到问题。 简短的问题:有什么方法可以在 JPanel 重绘完成后立即获得通知或与其同步代码吗? 详细版本: 我的程序可以将 xy
我在java中使用2个类class1和class2,它们都位于不同的包中。 class2 中定义了一个 paintComponent() 和一个 test()。我按以下顺序从 class1 调用这些方
Full project here https://github.com/jafetrd/easyImageEditor 我正在尝试使用paintComponent()将颜色应用于图像,这是我使用的类
我正在尝试制作一个 JFrame 程序,将二进制-十进制-十六进制转换器与按钮连接起来。其中一部分,我想绘制圆圈来表示一排圆圈中的二进制数,其中实心圆圈代表一,空心圆圈代表零。但是,当我尝试调用 re
我两周前才开始学习java,所以我对java还不太了解。我正在尝试让一个球在框架内弹跳或移动。但当我在线程中运行它时,它不会重新绘制/更新,但如果我使用 while 循环或计时器,它就可以正常工作,我
我正在尝试制作一款三消游戏。我试图为实际发生的情况创建一些视觉辅助,首先将需要删除的 gem 标记为“黑色”,然后让重力完成它的工作。我正在努力做到这一点,在将它们标记为“黑色”后,我调用了 repa
我正在编写一个 Java 程序,它将根据按下的按钮绘制圆形或矩形。虽然它确实绘制了给定的形状,但在绘制时它会在窗口的左上角(最有可能是(0,0))创建新按钮。我是否违反了paint()/repaint
我正在为学校项目开发一款游戏,一款类似炸弹人的游戏。 我正在使用 swing,并且使用 Canvas 来绘制图形,但 KeyListener 无法正常工作,因此我退出使用 Canvas 并开始使用 p
嘿,我正在尝试学习如何在java中使用图形,并且正在编写一个非常简单的代码,该代码获取图像并将其在窗口中成一条线移动,当它到达窗口边缘时,它会向下移动几个像素并从另一端开始。 我的问题是我的程序在重新
我试图了解 repaint 和 paintComponents 在 Java Swing 中如何工作,并想知道为什么这个程序在执行时只显示“hello”。 class MyLabel extends
我无法让我的重绘方法在我的 SimonPanel 类中工作。起初,我认为这是因为我使用了paint()而不是paintComponent(),但这似乎并没有解决问题。我的 SimonShape.jav
这就是我的任务。 我必须生成 4 张随机卡。之后,当按下“刷新”按钮时,卡片应再次随机化。我已经像这样实现了 repaint() 方法,但它不会改变卡片的显示方式。 public class Four
我看了很多答案,但仍然找不到解决方案。我有一个 JFrame 和两个 JPanel。我想在按下按钮时删除第一个面板并将其替换为第二个面板,但 repaint() 方法不会刷新框架。请帮忙。 这是我的框
我在这里尝试做的是从我的 loadbg() 方法中调用 repaint() 方法。但是,repaint() 不起作用,并且我的图像(存储在 var bg 中)不会加载到屏幕上。关于为什么这行不通的任何
我是一名优秀的程序员,十分优秀!