wxss文件中设置无边框样式无效
发布于 6 年前 作者 jing26 3973 次浏览 来自 问答

当此样式代码直接在button控件的style中填入时能实现按钮无边框的效果,但如果是在button空间用class引用wxss文件中的此样式代码则无法实现按钮无边框效果

4 回复

::after这个要加上,没用的话加个!important试试看

我也遇到这个问题, 有解决方案吗

我把源码和效果图给你看看

wxml:

<button class=‘btn’ plain=‘true’ bindtap=‘clkMinus’ data-index=’{{index}}’>

    <image src=’/icon/minus.png’ mode=‘aspectFit’ class=“btn_bg”></image>

</button>

wxss:

.btn{

position:absolute;

float:right;

border:0px solid red;

right:25px;

width:20px;

height:20px;

}

.btn::after{

border: none;

}

wxml:

<button class=‘btn’ plain=‘true’ bindtap=‘clkMinus’ data-index=’{{index}}’>

    <image src=’/icon/minus.png’ mode=‘aspectFit’ class=“btn_bg”></image>

</button>

wxss:

.btn{

position:absolute;

float:right;

border:0px solid red;

right:25px;

width:20px;

height:20px;

}

.button::after{

border: none;

}

wxml:

<button style=‘position:absolute;float:right;border:0px solid red;right:25px;width:20px;height:20px;’ plain=‘true’ bindtap=‘clkMinus’ data-index=’{{index}}’>

    <image src=’/icon/minus.png’ mode=‘aspectFit’ class=“btn_bg”></image>

</button>

.btn::after{

    border:none;

}

和.button::after{

    border:none;

}

我都试过,没有效果,倒是直接在style里设置边框0px有效果

button::after{

border:none;

}

回到顶部