画像を含む div 要素がいくつかあり、すべての画像の高さは 100% に設定され、幅が計算されます。高さは正常に機能しますが、親 div には画像の実際の幅があり、計算された幅よりも大きくなります。そのため、画像間にギャップが生じます。表示されている画像の幅 (ファイル自体の幅ではありません) を持つように div を作成するにはどうすればよいですか? それはhtml/CSSだけで解決できますか?
HTML:
<table>
<tr>
<td align-"center" valign="middle" style="background:#000;">
<div class="scrollable">
<div class="items">
<div>
<img style="height:100%;" src="001.png">
</div>
</div>
</div>
</td>
</tr>
</table>
CSS:
table {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
border-collapse: collapse;
border: 0;
}
td {
width: 100%;
height: 100%;
padding: 0;
border: 0;
}
.scrollable {
position: relative;
overflow: hidden;
width: 100%;
height: 100%;
max-height: 1000px;
}
.scrollable .items {
width: 25000px;
height: 100%;
position: absolute;
}
.items {float: center;}
.items div {
float: left;
width: auto;
padding: 0;
margin: 0;
}
何か案は?タンクス!