想使用button
自帶的disable
屬性和效果,但又不需要button
顯示邊框線
button
控件有一條淡灰色的邊框因妇,在控件上了樣式 border-radius: 0;
無法讓button
邊框隱藏
代碼如下:
.tx-btn {
z-index: 99;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 100rpx;
line-height: 100rpx;
text-align: center;
font-size: 28rpx;
color: #fff;
background-color: #4abdcc;
border-radius: 0;/*一般使用這個就是可以去掉邊框了*/
}
解決前效果
解決方案
發(fā)現(xiàn)button
控件有一個偽元素(::after)
耕漱,這偽元素有border
屬性肮蛹,默認為 border:1px solid rgba(0, 0, 0, 0.2)
所以border:none
屬性是有效果的溯香,只是被button::after
覆蓋了济舆,把button::after
的border
屬性設置為none
或0
即可
代碼如下:
.tx-btn {
z-index: 99;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 100rpx;
line-height: 100rpx;
text-align: center;
font-size: 28rpx;
color: #fff;
background-color: #4abdcc;
border-radius: 0;
}
button[class="tx-btn"]::after {
border: 0;
}
解決后效果