It was whilst writing a previous post that I spotted a problem with embedding iframes in WordPress postings. As I was reviewing a book I wanted to add an Amazon Product link. These product links are in the form of iframes. An example of the HTML is below. I added the align="right" myself as I wanted the text to flow around the iframe.
<iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=rmlcouk- 21&o=2&p=8&l=as1&asins=0099418371&fc1=000000&IS2=1 <1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" align="right"></iframe>
You can see from the image that in Wordpress (in the default theme anyway) there is no spacing between the left edge of the image and the text. This looks wrong so I wanted to find a solution to this.
It seems that there are no padding tags that you can add to an iframe unless you use style sheets. I wanted a simple solution that I could just embed in the HTML. The solution that I chose was to put the iframe in a table and set the cellspacing attribute of the table to the required amount padding. Instead of using align in the iframe I am now using it in the table. The HTML and result of this change are shown below.
<table border="0" cellspacing="10" align="right"><tr><td> <iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=rmlcouk- 21&o=2&p=8&l=as1&asins=0099418371&fc1=000000&IS2=1 <1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe> </td></tr></table>
You’ll probably agree that the Amazon product links looks much better with the extra spacing.


