【发布时间】:2023-03-24 17:16:01
【问题描述】:
<div className="content">
<div style={{ float: "left" }}> {pedido.nombre}</div> //name
<div style={{ float: "right" }}> ${pedido.precio}</div> //price
</div>
左侧应该是名称,右侧是价格,但它保持在另一侧
就在那儿
【问题讨论】:
-
stackblitz.com/edit/typescript-apbokz?file=index.html 如果它真的需要“浮动”。否则,请使用 Robert 和 azium 建议的 flex - 另请参阅本指南:css-tricks.com/snippets/css/a-guide-to-flexbox
-
这能回答你的问题吗? how to place two divs besides each other