2015-02-07 53 views
2

我在我的HTML代码如下面的代码更img标签,img标签宽度高度问题在Firefox

<div id="container" > 
    <div> 
     <img alt="Image1" id="Image1" src="" width="130px" height="90px" class="img"> 
     <input type="file" id="files1" class="fileUpload" name="files1[]" style="display:none" value="Select Image"> 
     <br> 
     <br> 
     <img alt="Image2" id="Image2" src="" width="130px" height="90px" class="img"> 
     <input type="file" id="files2" class="fileUpload" name="files1[]" style="display:none" value="Select Image"> 
     <br> 
     <br> 
     <img alt="Image3" id="Image3" src="" width="130px" height="90px" class="img"> 
     <input type="file" id="files3" class="fileUpload" name="files1[]" style="display:none" value="Select Image"> 
     <br> 
     <br> 
     <img alt="Image4" id="Image4" src="" width="130px" height="90px" class="img"> 
     <input type="file" id="files4" class="fileUpload" name="files1[]" style="display:none" value="Select Image"> 
     <br> 
     <br> 
     <img alt="Image5" id="Image5" src="" width="130px" height="90px" class="img"> 
     <input type="file" id="files5" class="fileUpload" name="files1[]" style="display:none" value="Select Image"> 
     <br> 
     <br> 
    </div> 
</div> 

更新时间:

MyCSSsoFar.css

#container { 
    width: 600px; 
} 

#container div { 
    float: left; 
    height: 300px; 
    width: 300px; 
} 

当我运行这个在铬上其宽度如下图所示,

enter image description here

但是,当我在Firefox上运行其不与原单宽度和高度像下面的图像显示,

enter image description here

我想在所有browser.How其宽度和高度类似镀铬显示解决这个问题?

+0

请问你的CSS看起来像那么远? – pbaldauf 2015-02-07 11:05:25

+0

尝试加上'''' – 2015-02-07 11:06:55

+0

@pbaldauf现在检查我的问题。 – MMMMS 2015-02-07 11:08:34

回答

2

我认为你缺少你的img -elements的display: block财产。默认情况下,浏览器将添加display: inline

img { 
    border: 1px solid red; 
    display: block; 
} 

这是一个快速的Fiddle

+0

其工作正常。感谢您的解释。 – MMMMS 2015-02-07 11:17:52

1

添加下面的CSS:

.img{ 
    display:block; 
    border:1px solid; 
} 

检查小提琴这里:Fiddle

+0

谢谢你的回应! – MMMMS 2015-02-07 11:19:29

1

继承人是一个选择,如果你想显示默认破碎图像图标(这也解决您的问题)

img{ 
    -moz-force-broken-image-icon:1; 
}