Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何将嵌入式soundcloud小部件居中对齐?_Html_Css_Widget_Soundcloud - Fatal编程技术网

Html 如何将嵌入式soundcloud小部件居中对齐?

Html 如何将嵌入式soundcloud小部件居中对齐?,html,css,widget,soundcloud,Html,Css,Widget,Soundcloud,我使用了soundcloud的小部件API,并将小部件嵌入到我的HTML文件中,但我在对齐它时遇到了问题 HTML代码是 <iframe width="50%" height="300" scrolling="no" frameborder="no" align="middle" src="musiclink&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_

我使用了soundcloud的小部件API,并将小部件嵌入到我的HTML文件中,但我在对齐它时遇到了问题

HTML代码是

<iframe width="50%" height="300" scrolling="no" frameborder="no" align="middle" src="musiclink&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>
但这也不起作用


我做错了什么/遗漏了什么?

您可以用div环绕iframe:

<div style='text-align:center'>
<iframe width="50%" height="300" scrolling="no" frameborder="no" align="center" src="musiclink&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>
</div>

您可以用div环绕iframe:

<div style='text-align:center'>
<iframe width="50%" height="300" scrolling="no" frameborder="no" align="center" src="musiclink&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>
</div>

middle
valign
的值。 改用
align=“center”

更多关于
valign


有关对齐的详细信息:

middle
valign
的值。 改用
align=“center”

更多关于
valign


有关对齐的详细信息:

在iframe周围放置一个div,并将左右边距设置为自动。它将把这个div放在容器的中心

<div style='margin:0 auto;'>
<iframe width="50%" height="300" scrolling="no" frameborder="no" align="center" src="musiclink&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>
</div>

在iframe周围放置一个div,并将左右边距设置为自动。它将把这个div放在容器的中心

<div style='margin:0 auto;'>
<iframe width="50%" height="300" scrolling="no" frameborder="no" align="center" src="musiclink&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>
</div>