HTML / CSS用图像对段落进行边距

问题描述

我想添加一些边距/填充,但保持段落的优美/整洁和响应迅速。

我尝试添加margin: 10px,但它仅适用于第一行

enter image description here

有没有一种方法可以对上面的代码进行调整,使其具有一些填充/边距,而不会影响响应速度。

请注意,由于客户的奇怪限制,我无法在上面的代码中使用 任何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。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...