You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在PayPal捐赠按钮JS代码中设置图片宽高(150px*60px)?

修改PayPal捐赠按钮图片尺寸

直接在你的image配置对象里添加width和height属性就能指定图片尺寸,修改后的完整代码如下:

<script>
PayPal.Donation.Button({
    env:'production',
    hosted_button_id:'XXXXXXXX',
    image: {
        src:'assets/img/donate-main.png',
        alt:'Donate with PayPal button',
        title:'PayPal - The safer, easier way to pay online!',
        width: '150px',
        height: '60px'
    }
}).render('#donate-button');
</script>

说明

PayPal捐赠按钮的配置项中,image对象支持直接定义图片的宽高参数,只需把你需要的尺寸以字符串形式(带单位)添加进去即可,不需要额外的CSS或复杂操作。

内容的提问来源于stack exchange,提问作者Marek Sanoba

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 17:57:05