我想在我的网页中放置一张手机图片,并且希望所有内容都显示在手机内。为了实际演示,请查看http://goratchet.com/components/,并告诉我如何做到这一点。现场演示。
<div class="device" style="" id="barsInDevice" style="background-color:Lime;"></div>
CSS:
.device {
position: relative;
top: 50px;
display: block;
width: 395px;
height: 813px;
margin-left: -20px;
font-family: "Helvetica Neue",sans-serif;
background-image: url(http://goratchet.com/assets/img/device-sprite.png);
background-repeat: no-repeat;
background-position: 0 0;
background-size: 300%;
-webkit-transition: background-image .1s linear;
-moz-transition: background-image .1s linear;
transition: background-image .1s linear;
}
你只需要在图片的边界内添加你所需的内容。