当窗户很大时,图像不会停留在div内

时间:2015-07-23 19:37:34

标签: html css image

我的图片需要位于特定位置,因此我在需要的位置添加了div并在其中添加了img标记,但是{ {1}}标记位于img标记内,图像进入页面的右下角。当浏览器窗口很小时,不会发生这种情况。

CSS:

div

HTML:

#teamimg {
    width:10%;
    height:50px;
    background-color:blue;
    overflow: auto;
    float:left;
}

1 个答案:

答案 0 :(得分:0)

overflow:hidden规则上设置#teamimg,然后您可以将图片设为background-image background-size:cover;。 :)

相关问题