【问题标题】:two sections on same line同一行的两个部分
【发布时间】:2019-02-20 21:10:00
【问题描述】:

我有两个部分目前位于不同的行。 它们都包含多行文本,我需要它们彼此相邻。 我需要它有 10px 的边距。

有人可以帮帮我吗?

【问题讨论】:

标签: html css


【解决方案1】:

<div style="display: flex">
    <section style="margin-right: 10px; background-color: red;">left section</section>
    <section >left section</section>
</div>

您需要将这些部分包装成 display flex 元素

【讨论】:

  • 我们有可运行的代码sn-ps,请使用它们而不是外部链接
  • 有没有办法用浮动来做到这一点
  • 这是可能的,但非常糟糕的做法,现在我们有弹性盒子和布局网格,浮动没用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-18
  • 2021-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-23
相关资源
最近更新 更多