html - 如何在左侧每行制作 4 个项目,在右侧制作 4 个项目
问题描述
我想实现以下目标。我尝试了这段代码,但仍然无法实现。请参阅所附图片。4张图片;左边有 2 张,旁边有文字……还有右边有 2 张图片,旁边有文字。与所附图像中的完全一样。
.thumbnailLeftSmallIconBottom {
float: left;
/*width:50%;*/
padding: 5px;
/*clear: both;*/
/*display:inline-block;*/
}
.thumbnailRightSmallIcon {
float: right;
width: 50%;
}
.thumbnailSmallImageAll::after {
content: "";
display: table;
clear: both;
}
<div class="thumbnailLeftSmallIcon1">
<div class="thumbnailLeftSmallIconTop">
<img class="thumbnailSmallImage" src="~/Content/images/house_50px.png" alt="Image">
</div>
<div class="thumbnailLeftSmallIconTop">
<span> @Html.DisplayFor(modelItem => house) </span>
</div>
<div class="thumbnailLeftSmallIconBottom">
<img class="thumbnailSmallImage" src="~/Content/images/bedroom_80px.png" alt="Image">
</div>
<div class="thumbnailLeftSmallIconBottom">
<span> @Html.DisplayFor(modelItem => bedroom) </span>
</div>
解决方案
试试表:
<table>
<tr>
<td>
<div class="thumbnailLeftSmallIconTop">
<img class="thumbnailSmallImage" src="~/Content/images/house_50px.png" alt="Image">
<span> @Html.DisplayFor(modelItem => house) </span>
</div>
</td>
<td>
<div class="thumbnailLeftSmallIconBottom">
<img class="thumbnailSmallImage" src="~/Content/images/bedroom_80px.png" alt="Image">
<span> @Html.DisplayFor(modelItem => bedroom) </span>
</div>
</td>
</tr>
<tr>
<td>
<div class="thumbnailLeftSmallIconTop">
<img class="thumbnailSmallImage" src="~/Content/images/house_50px.png" alt="Image">
<span> @Html.DisplayFor(modelItem => house) </span>
</div>
</td>
<td>
<div class="thumbnailLeftSmallIconBottom">
<img class="thumbnailSmallImage" src="~/Content/images/bedroom_80px.png" alt="Image">
<span> @Html.DisplayFor(modelItem => bedroom) </span>
</div>
</td>
</tr>
</table>
tr 表示行
td 表示单元格
推荐阅读
- asp-classic - 如何在 asp classic 中获取 request.body 值?
- sql - 执行时间较长的 SQL 查询
- php - 如何在 WooCommerce 中获取变量产品的变体 ID?
- php - 电子邮件通知上的自定义结帐结算字段
- visual-studio - VS2019:将书签链接到当前 git 分支的扩展或默认行为
- javascript - 在反应中播放从父亲到儿子的音频
- windows - 覆盖 DLL 的反参数
- c++ - 是否有可能制作一个现代的、可移植的“等待输入”实现?
- node.js - MongoDB findOneAndUpdate 返回 null
- javascript - 在高图表中,当图表具有高数据时,工具提示不会移动,这与低数据时不同