或更笼统地说,是否有不能用display:grid
设置样式的元素?
考虑:
button,
div {
display: grid;
grid-template-columns: 50px 50px;
}
/* Nevermind these, they're just for a consistent display */
button,
div {
border: 0;
background-color: gray;
color: black;
width: 100px;
text-align: center;
font-family: sans-serif;
font-size: 14px;
padding: 0;
}
Button:
<button>
<span>A</span>
<span>B</span>
</button>
<br>
Div:
<div>
<span>A</span>
<span>B</span>
</div>
这是 Firefox (61.0.1)中的结果:
这是 Chrome (68.0.3440.106)中的结果:
Chrome似乎不喜欢我尝试在按钮上使用display:grid
。这只是一个错误吗?还是出于某种目的?
答案 0 :(得分:9)
显然这是Chrome上的错误,在这里进行了详细说明:
https://github.com/rachelandrew/gridbugs#10-some-html-elements-cant-be-grid-containers
并在此处跟踪:
https://bugs.chromium.org/p/chromium/issues/detail?id=375693
(我在这里看不到任何进展。如果已解决,请编辑答案,否则,我会记住的)