Answers:
Jaap的回答:
<div class="image"></div>和在CSS中:
div.image {
   content:url(http://placehold.it/350x150);
}您可以在以下链接上尝试:http : //jsfiddle.net/XAh2d/
这是有关CSS内容的链接 http://css-tricks.com/css-content/
已在Chrome,firefox和Safari上进行了测试。(我在Mac上,所以如果有人在IE上有结果,请告诉我添加它)
div与您要求的图像尺寸不同。看看在div上添加边框会发生什么:jsfiddle.net/XAh2d/6没什么,因为div的大小为0x0,并且隐藏在图像后面。
                    你可以这样做:
<div class="picture1"> </div>并将其放入您的css文件中:
div.picture1 {
   width:100px; /*width of your image*/
   height:100px; /*height of your image*/
   background-image:url('yourimage.file');
   margin:0; /* If you want no margin */
   padding:0; /*if your want to padding */
}否则,只用它们
img标签。您打算如何完成?也许还有另一种编程解决方案,例如通过PHP getimagesize获取图像大小,然后为该特定图像回显相应的styleand或imgtag。
                    将其作为示例代码。用图像尺寸替换imageheight和image width。
<div style="background:yourimage.jpg no-repeat;height:imageheight px;width:imagewidth px">
</div>使用Javascript / Jquery:
imgdiv并设置宽度,高度和背景删除原件 img
  $(document).ready(function() {
    var image = $("<img>");
    var div = $("<div>")
    image.load(function() {
      div.css({
        "width": this.width,
        "height": this.height,
        "background-image": "url(" + this.src + ")"
      });
      $("#container").append(div);
    });
    image.attr("src", "test0.png");
  });
<img>