开发者

Trouble Putting a space between text and an iframe in XML

开发者 https://www.devze.com 2023-03-04 06:34 出处:网络
I have an XML file with the following relevant section <postText> <![CDATA[text <br> stuff<br />

I have an XML file with the following relevant section

<postText>
<![CDATA[text <br>
stuff<br />
<iframe width='560' height='349' src='http://www.youtube.com/embed/video'
 frameborder='0' marginheight='40px' allowfullscreen></iframe>]]>

</postText>

Using php simple开发者_开发知识库xmlloader i am able to print this item however there is no space between the text and the top of the youtube video despite the

tags and the marginheightvariable.


My guess is, that you maybe misinterpreted the attribute marginheight.

The marginheight attribute does not define the space between text <br>stuff<br /> and the <iframe>, but the space between the frame's content and the frame's top and bottom margin (i.e. inside the iframe).

One way to have a vertical space between your text and the iframe element is to wrap the <iframe> in a <div> and define a margin-top for the <div>:

<postText>
<![CDATA[text <br>
stuff<br /><div style="margin-top: 40px;">
<iframe width='560' height='349' src='http://www.youtube.com/embed/video'
 frameborder='0' marginheight='40px' allowfullscreen></iframe></div>]]>
</postText>
0

精彩评论

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