当图片左对齐时,如何在 HTML 中的图片和表格之间添加空格?

发布于 2024-10-20 06:59:02 字数 985 浏览 2 评论 0 原文

我想在图片和桌子之间留出一个空间,但不知道如何做。

这是我的代码..

<img src="images/hotel_gracia.jpg" width="200" height="150" align="left"/>
<table class="hotel">
<tr>
<th>Room with Breakfast (P.P)</th>
<th>Superior</th>
<th>Economy</th>
</tr>
<td>12th April-16th April & 5th October-23rd October 2011</td>
<td>42 Euros</td>
<td>37 Euros</td>
</tr>
<tr>
<td>26th April-1st June 2011 </td>
<td>50 Euros</td>
<td>42 Euros</td>
</tr>
<tr>
<td>6th Apr-11th Apr, 17th Apr-25th Apr
2nd Jun-17th Jul & 12th Sept-4th Oct 2011
</td>
<td>55 Euros</td>
<td>45 Euros</td>
</tr>
<td>18th July-11th September 2011</td>
<td>59 Euros</td>
<td>50 Euros</td>
</tr>
</table>

目前桌子就在图片旁边,我想要它们之间有一点空间。

我用过“nbsp;”之前但不确定我把它放在哪里。

I want to put a space between my picture and table but not sure how.

Here is my code..

<img src="images/hotel_gracia.jpg" width="200" height="150" align="left"/>
<table class="hotel">
<tr>
<th>Room with Breakfast (P.P)</th>
<th>Superior</th>
<th>Economy</th>
</tr>
<td>12th April-16th April & 5th October-23rd October 2011</td>
<td>42 Euros</td>
<td>37 Euros</td>
</tr>
<tr>
<td>26th April-1st June 2011 </td>
<td>50 Euros</td>
<td>42 Euros</td>
</tr>
<tr>
<td>6th Apr-11th Apr, 17th Apr-25th Apr
2nd Jun-17th Jul & 12th Sept-4th Oct 2011
</td>
<td>55 Euros</td>
<td>45 Euros</td>
</tr>
<td>18th July-11th September 2011</td>
<td>59 Euros</td>
<td>50 Euros</td>
</tr>
</table>

At present the table is right next to the picture, I would like a little space between them.

I've used "nbsp;" before but not sure where I put it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心如荒岛 2024-10-27 06:59:02

您应该了解 CSS 盒模型:

注意:大多数人会推荐一个 css 类来保留样式。

You should learn about the CSS box model:

<img style="margin-right:20px"

Note: Most will recommend a css class to keep the styles.

淡淡的优雅 2024-10-27 06:59:02

用分号分隔多个样式设置:

<img style="margin-right:10px; border: 6px double #545565" 
src="images/hotel_idania.jpg" width="200" height="150" align="left"/>

尽管您可能需要 margin-bottom 而不是 margin-right,因为表格是块元素,不会与图像出现在同一行默认情况下。

Separate multiple style settings with semicolons:

<img style="margin-right:10px; border: 6px double #545565" 
src="images/hotel_idania.jpg" width="200" height="150" align="left"/>

Though you probably want margin-bottom instead of margin-right because tables are block elements and won't appear on the same line as your image by default.

此刻的回忆 2024-10-27 06:59:02
<img style="margin-right:10px; border:6px double #545565"
    src = "images/hotel_idania.jpg" width="200" height="150" align="left"/>
<img style="margin-right:10px; border:6px double #545565"
    src = "images/hotel_idania.jpg" width="200" height="150" align="left"/>
━╋う一瞬間旳綻放 2024-10-27 06:59:02

只需更改标签的内联样式即可。将其更改如下。

<img style="margin-right:10px; border:6px double #545565";

Just change your inline style of tag. change it as below.

<img style="margin-right:10px; border:6px double #545565";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文