问题描述
我想添加一些边距/填充,但保持段落的优美/整洁和响应迅速。
我尝试添加margin: 10px
,但它仅适用于第一行
有没有一种方法可以对上面的代码进行调整,使其具有一些填充/边距,而不会影响响应速度。
请注意,由于客户的奇怪限制,我无法在上面的代码中使用 任何JQUERY / Javascript。
<table>
<tbody>
<tr>
<td>
<div style="width:100%;height:auto;">
<div>
<img src="https://i.imgur.com/ieffVLU.png" width="360px" style="float:left;border: 1px solid black">
</div>
<div>
<h5 style="text-align: justify;">
<span style="font-weight: normal;">
a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something
</span>
</h5>
</div>
</div>
</td>
</tr>
</tbody>
</table>
解决方法
您可以在图像标签中添加“显示:阻止” 输出将是:
<table>
<tbody>
<tr>
<td>
<div style="width:100%;height:auto;">
<div>
<img src="https://i.imgur.com/ieffVLU.png" width="360px" style="float:left;border: 1px solid black; display:block">
</div>
<div>
<h5 style="text-align: justify;">
<span style="font-weight: normal;">
a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something
a nice paragraph about something a nice paragraph about something a nice paragraph about something
</span>
</h5>
</div>
</div>
</td>
</tr>
</tbody>
</table>
,
尝试将第一格的宽度从100%更改为360px。另外,删除第一个div内的多余div。如果不行,则将第二个div的跨度插入到img之后的第一个div。