微信小程序如何解决botton按钮对齐问题

如果botton不在其他控件下层,或者上层控件类型不为flex,可以用float调整botton显示位置,如float=right,则botton显示在右侧。

html 复制代码
<button type="primary" style="float: right;">测试</button>

<view style="display: block;">
  <button type="primary" style="float: right;">测试</button>
</view>

如果botton上层控件类型为flex,可以通过设置position=absoluted调整显示位置。

html 复制代码
<view style="display: flex;">
  <button type="primary" style="position: absolute;right: 0;">测试</button>
</view>

更多微信小程序内容欢迎关注博主。

有帮助欢迎打赏。

相关推荐
UXbot43 分钟前
UI设计工具推荐合集
前端·人工智能·ui
正在努力Coding1 小时前
SpringAI - 工具调用
java·spring·ai
小丑西瓜6661 小时前
CMake基础用法,cmake_minimum_required,project,add_executable
linux·服务器·c++·camke
晚风吹长发1 小时前
初步了解Linux中的命名管道及简单应用和简单日志
linux·运维·服务器·开发语言·数据结构·c++·算法
敲敲了个代码1 小时前
如何优化批量图片上传?队列机制+分片处理+断点续传三连击!(附源码)
前端·javascript·学习·职场和发展·node.js
@AfeiyuO1 小时前
Vue 引入全局样式scss
前端·vue·scss
光影少年1 小时前
flex布局和grid布局区别,实现两边固定布局中间自适应
前端·css3·web·ai编程
我尽力学1 小时前
面试 总结
java·spring boot·面试
爬台阶的蚂蚁2 小时前
Spring AI Alibaba基础概念
java·spring·ai
计算机学姐2 小时前
基于SpringBoot的演唱会抢票系统
java·spring boot·后端·spring·tomcat·intellij-idea·推荐算法