开发者

How do I put a space between a picture and a table in HTML when the picture is aligned to the left?

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&g开发者_Go百科t;
<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.


You should learn about the CSS box model:

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

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


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.


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


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

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜