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>
精彩评论