首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么在缩小浏览器窗口时不能缩小宽度图像?

问为什么在缩小浏览器窗口时不能缩小宽度图像?
EN

Stack Overflow用户
提问于 2012-10-12 04:55:42
回答 1查看 512关注 0票数 0

1为什么在缩小浏览器窗口时无法缩小宽度图像?

2为什么图像不在中心红色div中?

在jsFiddle中,我可以缩小图像(浏览器chrome)。

​

​

在我的site中,我不能缩小图像(浏览器chrome)。

​

​

代码:

代码语言:javascript
复制
<!DOCTYPE html>
<html>
<head>

  <style type='text/css'>
    #Blue
{
position:relative;
top:0px;
left:0px;
margin:0px auto;
height: auto;
width: 97%;
z-index: 10;
background:azure;
    border:5px solid blue;

}
#Red{
    position:relative;
    margin:auto;
    width:300px;
    height:100%;
    border:5px solid red;
    padding:0;
    margin-bottom:5px;
    bottom:0;

}

#Menu{
    width:100px;
    height:20px;
    background:yellow;
    margin:auto;
    display:none;
}

img {
    top:0px;      
    position: relative;
    margin:auto;
    width: 200px; 
    height: 200px;

}
#green{}

@media (max-width: 200px) {

#Menu{
        display:inline;
        margin:1px;
        text-align:center;    
        position:static;
        width:100%;;
    }
#Menu, #Red{
    width:auto!important;
    height:auto!important;
}

 #Red, img{
    position:static;
    max-width:100%;
}
}    

  </style>
</head>
<body>
  <div id="Blue">
<div id="Menu">Menu</div>   
    <div id="Red">

        <div id="Green">
            <picture alt="description of image">

  <img src="http://www.candcsavannahs.com/images/queenpawnee2.jpg" alt="description of image">

</picture>
        </div>
    </div>
</div>



</body>


</html>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-12 05:02:52

图片标签是什么?它不是一个标准的html标签,去掉它似乎可以让它正常工作。

代码语言:javascript
复制
        <div id="Green">
            <!-- <picture alt="description of image"> -->

  <img src="http://www.candcsavannahs.com/images/queenpawnee2.jpg" alt="description of image">

<!--    </picture> -->
        </div>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12848394

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档