uniapp打包微信小程序、抖音小程序中button的区别
uniapp打包微信小程序、抖音小程序中button的区别
源代码分析
1 | <button |
微信小程序效果图:
移植到抖音小程序后:
解决方法
1 | button::after { |
原因分析
微信小程序中的button组件有特定的css,背景可以用“background:none
”或者background-color: transparent;
去掉,但是边框再用“border : none
”去掉就不可以了,还是会有一个细细的边框,原因是微信小程序button的默认样式就是在渲染button之后,用::after再加一个边框。这也是微信小程序与h5的不同之处。所以我们使用:after选择器就可以实现去除边框。
background-color: transparent;
和 background: none;
之间的区别
background-color: transparent;
是用于将元素的背景颜色设置为透明。这意味着元素的背景会显示为其所在元素的背景或内容的背景。background: none;
是用于移除元素的背景,包括背景颜色、背景图像和背景属性的设置。这将使元素没有任何背景。
总的来说,background-color: transparent;
设置元素的背景颜色为透明,而 background: none;
移除元素的背景,使其没有任何背景。