html - CSS,HTML中的表格内的图像
问题描述
当我在半屏中打开页面时,它看起来像这样
但是当我全屏打开它时,它看起来像这样
我尝试添加 minmax-width
但我不知道问题出在哪里
.Price {
font-size: 10pt;
}
.infoS {
background-color: #da9b48;
color: rgb(31, 22, 5);
padding: 3px;
width: 90%;
margin: 0 auto;
margin-top: 15px;
padding-left: 45px;
}
.Pinfo {
font-size: 7pt;
}
<table>
<td class="infoS">
<p class="Pinfo">
PIXMA G640
</p>
<img src="./images/PIXMA G640.png" alt="Pixma photo printer" width="75" height="75">
<p class="Price">
Price : 150$
</p>
</td>
<td class="infoS">
<p class="Pinfo">
PIXMA TS7440
</p>
<img src="./images/PIXMA TS7440.png" alt="Pixma photo printer" width="75" height="75">
<p class="Price">
Price : 250$
</p>
</td>
<td class="infoS">
<p class="Pinfo">
PIXMA G540
</p>
<img src="./images/PIXMA G540.png" alt="Pixma photo printer" width="75" height="75">
<p class="Price">
Price : 170$
</p>
<td class="infoS">
<p class="Pinfo">
PIXMA G540
</p>
<img src="./images/PIXMA G540.png" alt="Pixma photo printer" width="75" height="75">
<p class="Price">
Price : 120$
</p>
</td>
</tr>
</table>
解决方案
**您的代码也缺少结束标记tr
和缺少td
标记。
对于解决方案,我建议您使用 'display: inline-flex'justify-content: space-evenly
在这种情况下。
.Price {
font-size: 10pt;
}
.infoS {
background-color: #da9b48;
color: rgb(31, 22, 5);
padding: 3px;
width: 90%;
margin: 0 auto;
margin-top: 15px;
padding-left: 45px;
}
.Pinfo {
font-size: 7pt;
}
tr.row {
width: 100vw;
display: inline-flex;
justify-content: space-evenly;
}
<table>
<tr class="row">
<td class="infoS">
<p class="Pinfo">
PIXMA G640
</p>
<img src="https://i.picsum.photos/id/977/536/354.jpg?hmac=slVWYbVbxWnJGkpSJ9FX_iXkIBqJAupfNrNR1CWBoAQ" alt="Pixma photo printer" width="75" height="75">
<p class="Price">
Price : 150$
</p>
</td>
<td class="infoS">
<p class="Pinfo">
PIXMA TS7440
</p>
<img src="https://i.picsum.photos/id/977/536/354.jpg?hmac=slVWYbVbxWnJGkpSJ9FX_iXkIBqJAupfNrNR1CWBoAQ" alt="Pixma photo printer" width="75" height="75">
<p class="Price">
Price : 250$
</p>
</td>
<td class="infoS">
<p class="Pinfo">
PIXMA G540
</p>
<img src="https://i.picsum.photos/id/977/536/354.jpg?hmac=slVWYbVbxWnJGkpSJ9FX_iXkIBqJAupfNrNR1CWBoAQ" alt="Pixma photo printer" width="75" height="75">
<p class="Price">
Price : 170$
</p>
</td>
<td class="infoS">
<p class="Pinfo">
PIXMA G540
</p>
<img src="https://i.picsum.photos/id/977/536/354.jpg?hmac=slVWYbVbxWnJGkpSJ9FX_iXkIBqJAupfNrNR1CWBoAQ" alt="Pixma photo printer" width="75" height="75">
<p class="Price">
Price : 120$
</p>
</td>
</tr>
</table>
推荐阅读
- android - Recyclerview 没有显示 kotlin
- django - Django 1.11 到 2.0 => 单元测试慢 2 倍
- python - django // 1054,“字段列表”中的未知列“rank.post_id_id””
- scala - 如何从 spark 源代码构建与 spark 下载中可用的 JAR 相同的 JAR?
- google-apps-script - 您无权调用 getUserCache
- snakemake - snakemake:通过更改所有命令行来丢失最后一条规则
- reactjs - 如何在我的反应项目中全局导入反应引导类?
- authorization - Keycloak JS 前端,将身份验证传递给子域和新窗口/选项卡
- python - 按相同值过滤列
- java - Spark:partitionBy的奇怪行为,字段变得不可读