CSS 浮动不起作用?为什么?
所以我目前正在创建一个网站,但遇到了问题。我有这个 div,在它的左上角我想要一个类似 facebook 的按钮,然后我想要文本包围它,我知道这可以通过“浮动”属性来修复,但它不起作用,相反,我想要围绕 facebook 之类按钮的文本位于按钮下方,并且按钮右侧留有一个巨大的空间。
这是我的代码:
<p>
<div class="float">
<iframe src="http://www.facebook.com/plugins/like.php?href=www.mysite.com&send=false&layout=box_count&width=450&show_faces=false&action=like&colorscheme=dark&font=arial&height=90" scrolling="no" frameborder="1" style="border:none; overflow:hidden; width:450px; height:90px;" allowTransparency="true">
</iframe>
</div>
test
</p>
CSS 代码是
div.float{
float:left;
}
So I am currently creating a website and I have a problem. I have this div, and in the left top corner of it I want a facebook like button, and then I want text to surround it, I know this can be fixed through the "float" property, but it just won't work, instead, the text which I want to surround the facebook like button goes under the button and there is a huge space left to the right of the button..
This is my code:
<p>
<div class="float">
<iframe src="http://www.facebook.com/plugins/like.php?href=www.mysite.com&send=false&layout=box_count&width=450&show_faces=false&action=like&colorscheme=dark&font=arial&height=90" scrolling="no" frameborder="1" style="border:none; overflow:hidden; width:450px; height:90px;" allowTransparency="true">
</iframe>
</div>
test
</p>
The css code is
div.float{
float:left;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
检查此解决方案:
http://jsfiddle.net/j9QSj/
让我知道这是否是您想要的为了。
Check this solution:
http://jsfiddle.net/j9QSj/
Let me know if it's what you're looking for.
您可能需要在下一个 div 或向下跨度上清除:。您可以与 http://www.pastebin.com/ 共享您的代码。
You probably need a clear: both on the next div or span down. You can share your code with http://www.pastebin.com/.
iframe 的宽度是 450px...你可能想说的是 45px
在网址中将 width=450 更改为 width=45 这应该可以解决您的问题。
The width of the iframe is 450px... you probably meant it to be 45px
in the url change width=450 to width=45 that should fix your problem.
css定义错误。
它需要
代替
The css definition is wrong.
It needs to be
instead of