dr200166 2015-01-27 01:01
浏览 22
已采纳

如何让PNG在WP电子商务中显示为按钮

I'm currently building a website as a whole sale website. I'm having trouble getting a PNG to work as a button. WP Ecommerce comes with an automatic "add to cart" button on all of their pages. I'm having the hardest time figuring this out. I did this to my directory so far.

  1. changed a custom "add to cart" PNG to the images directory.

  2. Went to the default.css page and changed:

    input.wpsc_buy_button{}

to:

 input.wpsc_buy_button{
 background-image: url(images/addtocart.png);
 }

I don't know exactly what Im doing wrong. Maybe I didn't echo it on the product page? I feel like it should have because I kept the names the same.

Either way, any form of help would be awesome. Thanks!

  • 写回答

1条回答 默认 最新

  • dty5753 2015-01-27 01:57
    关注

    A few things to note:

    1. The class, wpsc_buy_button, is on a button, not an input.
    2. The CSS that is putting the button in there now uses an !important tag so you must also use this and be more specific with your selector to override that style.
    3. images/addtocart.png is not going to be a valid path to images in your media library. I'm not certain where it lives but the path is more likely to be something like this: http://inkvia.com/wp-content/uploads/2015/01/addtocart.png

    Example CSS

    button.wpsc_buy_button {
      background: url(/wp-content/themes/mazine/images/addtocart.png) no-repeat !important;
      height: 43px;
      width: 180px;
    }
    
    button.wpsc_buy_button span, button.wpsc_buy_button span span {
      background: none!important;
      text-indent: -99999px;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路