gpt4 book ai didi

html - webkit下xhtml设置div为特定高度

转载 作者:行者123 更新时间:2023-11-27 22:48:57 25 4
gpt4 key购买 nike

目标:消除两行图像之间的白色间隙:

enter image description here

复制案例:https://jsfiddle.net/kromato4/5cyLvnut/

差距不会出现在 html 下,但当我切换到 xhtml 时突然出现(而这将进入的 epub 需要 xhtml)。

这是 html:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>divs to the rescue?</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="grid">
<div class="gridrow">
<div ><img src="https://i.imgur.com/pvh1qBn.jpg"/></div>
<div ><img src="https://i.imgur.com/Mmnz4YT.gif"/></div>
<div ><img src="https://i.imgur.com/3nAJxUE.gif"/></div>
</div>
<div class="gridrow">
<div><img src="https://i.imgur.com/C8mn56T.gif" /></div>
<div><img src="https://i.imgur.com/Tic5I5b.gif" /></div>
</div>
</div>
</body>
</html>

和最小的 CSS:

.grid {
display: table;
width: 585px;
height: 580px;
}
.gridrow {
display: table;
}
.gridrow > div {
display: table-cell;

我在 divs 上设置高度无济于事。顶行图像都是 255 像素高,但包含图像的 div 似乎多了 4 像素高。还尝试使用包含行和列的表,但显示了同样的问题。任何帮助表示赞赏,因为当图像都是来自同一部漫画的面板时,这种差距会让人分心。

最佳答案

在图片标签上定义显示 block ,见附件代码

.gridrow > div img { 
display: block;
}

关于html - webkit下xhtml设置div为特定高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59540073/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com