This topic created in 804 days ago, the information mentioned may be changed or developed.
示意图大致如下:
--------
---A-x-
--------
现在有个 Group ,Group 里面有个按钮 A ,A 水平居中,A 的右边有一个小按钮 x ( x 靠着 A 的右边,比如间距 5px )。
试了一圈,一直没有好的解决办法。谢谢!
如果 Group 里面有 2 个按钮 A 和 B ,A 和 B 整体水平居中,另有一个小按钮 x 在 B 的右边,实现是一样吗。
-----------
---A-B-x-
-----------
3 replies • 2024-03-12 12:36:37 +08:00
 |
|
1
chenluo0429 Mar 11, 2024 via Android 1
实际上是个 css 问题。A 作为父元素,position 为 relative ,x 作为 A 的子元素,样式 position: absolute; right: 0; top: 50%; transform: translate(100%, -50%); 第二个问题同理
|
 |
|
2
fd9xr Mar 12, 2024 via iPhone
css 就好啦 Mantine 就不可能能实现这种东西呀
|
 |
|
3
duan602728596 Mar 12, 2024 1
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style> .container { width: 300px; padding: 16px 0; border: 1px solid #000; text-align: center; }
.btn { width: 50px; height: 30px; }
.btn-item { position: relative; display: inline-block; margin: 0 4px; text-align: left; }
.small-btn { position: absolute; bottom: 0; right: -75px; } </style> </head> <body> <div class="container"> <div class="btn-item"> <button class="btn">Btn1</button> </div> <div class="btn-item"> <button class="btn">Btn2</button> <button class="small-btn">Small btn</button> </div> </div> </body> </html>
|