各位,我有一个像这样的 div:
<div id="image-container">
<img id="image" src="#" > //with an image inside
</div>
这样进行样式设置:
#image-container {
width: 750px;
height: 360px !important;
text-align: center;
}
但是当我加载页面并检查图像以了解其尺寸时,它显示:
element.style {
height: 600px;
width: 600px;
}
为什么图像没有继承div的宽度?由于某些原因,我无法手动设置所需的图像宽度,因此我不能这样做:
#image {
width : 330px; //manually putting width
height: 303px; //same same which i cannot do this for some reason
}
你有任何想法为什么会出现这种情况,或有解决方法吗?
我尝试了以下解决方案:
查看元素后,我得到了以下内容:
#image {
height: inherit; // crossed-out
width: inherit; // crossed-out
}
有东西正在覆盖我的图像尺寸。