Html 如何使图像向左浮动,而其他图像则不会';你不能到下面去吗?
我可以在不接触html的情况下完成这项工作吗 htmlHtml 如何使图像向左浮动,而其他图像则不会';你不能到下面去吗?,html,css,Html,Css,我可以在不接触html的情况下完成这项工作吗 html <div> <img src="http://i50.tinypic.com/1zey0j8.gif" alt="" />WALLPAPER <span>some paragraph here some paragraph here /*this should not go below the image*/ some paragraph here some
<div>
<img src="http://i50.tinypic.com/1zey0j8.gif" alt="" />WALLPAPER
<span>some paragraph here
some paragraph here /*this should not go below the image*/
some paragraph here
some paragraph here
</span>
</div>
编辑
卡洛扬·伊万诺夫给了我一个最好的答案。但是我想知道溢出隐藏是如何实现的?添加
溢出:隐藏代码>到跨度
添加溢出:隐藏代码>到跨度
给图像留一个底边,如:
img {
float: left;
width: 50px;
height: 50px;
margin-bottom: 200px;
}
给您的图像留一个底边,如:
img {
float: left;
width: 50px;
height: 50px;
margin-bottom: 200px;
}
您应该将span元素也向左浮动。并确保其最大宽度为150px
CSS应该如下所示:
div{width:200px;}
img{float:left; width:50px;height:50px;}
span{display:block; width:140px; padding-left:10px;}
您应该将跨度元素也浮动到左侧。并确保其最大宽度为150px
CSS应该如下所示:
div{width:200px;}
img{float:left; width:50px;height:50px;}
span{display:block; width:140px; padding-left:10px;}
因为您可能不知道图像下方的高度。所以使用保证金底部:100%代码>到您的图像
编辑
作为编辑后的问题,我为您提供了一个链接
因为您可能不知道图像下方的高度。所以使用保证金底部:100%代码>到您的图像
编辑
作为编辑后的问题,我为您提供了一个链接
将跨度更改为:span{display:block;float:left;width:150px}
将跨度更改为:span{display:block;float:left;width:150px}