微信小程序如何解决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>

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

有帮助欢迎打赏。

相关推荐
noipp几秒前
推荐题目:洛谷 P16510 [GKS 2015 #C] gRanks
java·c语言·开发语言·c++·python·算法
flyinmind几秒前
Java环境与Android环境中使用QuickJS
java·开发语言·javascript·quickjs
不吃鱼的羊2 分钟前
DaVinci Developer自动连接
java·开发语言
小二·2 分钟前
Prompt Engineering 高级技巧:CoT/ToT/ReAct 等进阶方法论实战
前端·react.js·prompt
chancygcx_3 分钟前
前端框架React day1--React入门
前端·react.js·前端框架
farerboy8 分钟前
15-Java while 和 do...while循环
java·后端
在繁华处11 分钟前
Java从零到熟练(十二):Java与AI工具整合
java·人工智能·python
凯瑟琳.奥古斯特16 分钟前
力扣1235完整解法详解
java·开发语言·leetcode
quan_泉18 分钟前
DIDCTF 取证初学者
java·服务器·前端
i220818 Faiz Ul20 分钟前
民谣网站|基于Springboot的民谣网站管理系统(源码+数据库+文档)
java·数据库·spring boot·后端·论文·毕设·民谣网站