收藏
回答

小程序button去除边框问题

在网上搜了好多,但都是没有解决。所以来求助。 点击抽奖因为要获取用户手机号,所以用了button。但是修改了好多,发现一直存在黑色的边框。


上代码

html

<button class="chou" style='background-image:url(https://xxx.cn/playbtn.png);'plain='true'  bindtap="{{isclick}}"  open-type="start" bindgetphonenumber="start" ></button>
css

.chou {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180rpx;
  height: 180rpx;
  z-index: 10;
  margin: auto;
  padding: 0;
  background-size: 180rpx 180rpx;
  background-repeat: no-repeat;
  border: none;
}
button::before {
  border: 0;
  border: none;
}
button::after {
  border: 0;
  border: none;
}


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

2 个回答

  • Z
    Z
    2018-11-27
    button {
        margin: 0;
        padding: 0;
        background-color: inherit;
        position: static;
    }
     
    button:after {
        content: none;
    }
     
    button::after {
        border: none;
    }

    试试这个

    2018-11-27
    有用 7
    回复 7
    • 淡然²⁰²⁰
      淡然²⁰²⁰
      2018-11-27

      没有删除.chou的样式。复制了您的代码。还是没有效果

      2018-11-27
      回复
    • Z
      Z
      2018-11-27回复淡然²⁰²⁰

      你把

      plain='true'

      去掉就可以了


      2018-11-27
      回复
    • 淡然²⁰²⁰
      淡然²⁰²⁰
      2018-11-27回复Z

      可以了,多谢,多谢了

      2018-11-27
      回复
    • qinw
      qinw
      2019-11-15
      6p6p
      2019-11-15
      回复
    • Aurora
      Aurora
      2020-04-12
      棒,谢谢
      2020-04-12
      回复
    查看更多(2)
  • 杨普晓
    杨普晓
    2020-07-03
    //如果仅仅是<Button />
    button::after {
        border-style: none;
    }
    //如果给Button添加了type=primary属性
    button[type=primary]{
        border-style: none;
    }
    //如果给Button添加了 plain 的属性
    button[plain]{
        border-style: none;
    }
    //如果给Button添加了 type=primary 和 plain
    button[type=primary][plain]{
        border-style: none;
    }
    
    2020-07-03
    有用 4
    回复 3
    • QIANGQ
      QIANGQ
      2021-04-27
      感谢
      2021-04-27
      回复
    • QZJ
      QZJ
      2022-02-27
      解决大问题
      2022-02-27
      回复
    • evan
      evan
      2023-06-28
      大大的赞
      2023-06-28
      回复
登录 后发表内容