这张图片是我用来制作三维动画的。我只需要显示这个图像的第一个字符。我用的是背景职位-
background-position:0px 200px;
但它在这里显示了完整的图像。
样式
position:absolute;
top: 40px;left: 40px;
background-position: 0px 200px;
形象-
请引导我通过Js小提琴。小提琴
发布于 2013-02-07 05:49:04
看到这个链接,我希望这会对你有所帮助:http://jsfiddle.net/9RYph/7/
div {
top: 40px;left: 40px;
background-size:100%;
background:url('http://i.stack.imgur.com/PuAjg.jpg');
width: 50%;
height: 600px;
}
发布于 2013-02-07 05:48:33
试试这个
img{
clip:rect(0px,300px,auto,0px);
position:absolute;
}
发布于 2013-02-07 05:38:48
您使用的是img
,但是background-position
属性不适用于img
元素,您需要在CSS中使用background-image
属性,需要在这里设置元素的宽度,因此如果字符宽度在100px
和200px
的高度附近,则不要将height
和width
分别设置为200px
和100px
<div></div>
div {
height: 200px;
width: 100px;
background-image: url();
background-position: ;
background-repeat: no-repeat;
/* Other styles goes here */
}
https://stackoverflow.com/questions/14744297
复制相似问题