【发布时间】:2019-01-10 16:54:34
【问题描述】:
我在使用背景图片的表格时遇到问题。
我需要背景图像填充 div 容器的 100% 宽度,并自动完成高度保持他的纵横比。
#pitch{background-color:d9ffd9;background:url('https://conceptdraw.com/a2048c3/p1/preview/640/pict--sport-field-plan-template-sport-field-plan---template.png--diagram-flowchart-example.png');background-position: top center;background-repeat: no-repeat;background-size: 100%,100%;}
<div id="pitch-container">
<table id="pitch" width="100%">
<tr>
<td><img class="player-icon" src="https://www.freeiconspng.com/minicovers/sports-football-2-icon-12.png"><br>Player</td>
</tr>
</table>
</div>
结果:
【问题讨论】:
标签: html css html-table background-image