收藏
回答

css切图 css显示部分图片

想实现css的切图功能,代码在浏览器上有效,小程序切图无效,甚至连图片都没有了。

test.png是一张320x347像素的图片。


wxml代码如下:

<image src="/images/test.png" style="position:absolute;clip:rect(0px 100px 100px 0px);width:320px;height:347px">

</image>


将style写在wxss,同无效。

<image class="the-paper" src="/images/paper.png">

</image>

.the-paper{

position:absolute;

clip:rect(0px 100px 100px 0px);width:320px;height:347px

}

哪位同学有解决方案?


回答关注问题邀请回答
收藏

1 个回答

  • 连胜
    连胜
    2017-09-28

    建议你用背景图片,然后CSS定位过去,因为小程序里面的image标签和HTML中的还是有区别的~


    徽信:mianhuabingbei

    2017-09-28
    有用
    回复
登录 后发表内容