2011-01-27 90 views
0

我似乎无法浮动我的图像,文字不环绕它。我试过很清楚:两者似乎都不起作用。简单的HTML/CSS浮点问题?

#tree { 
    width:175px; 
    height:250px; 
    float:right; 
    margin-left:20px; 
    margin-top:24px; 
} 

#blackwhite { 
    width:200px; 
    height:125px; 
    float:left; 
    clear:both; 
    margin-right:20px; 
    margin-top: 100px; 

} 

非常感谢您的帮助!

回答

1

没有看到相关的html,很难说。但是,在黑暗中拍摄时,浮动物体会浮动到随后的元素的左侧或右侧。除非您希望它完全显示在它之前的元素之下,否则不要使用清除。如果你想要一个像浮到左边,并有文字环绕它周围的右侧,你可以尝试这样的事:

<img class='right' src='image.jpg' alt='' style='float:left;'/> 
<p>Here's the text that will wrap around the image that is floating to the left.</p> 
1

如果你clear:both;比你说你不想要的东西是在项目旁边,在任何一边。