【问题标题】:How does one change the positioning of text based on screen size? [closed]如何根据屏幕大小更改文本的位置? [关闭]
【发布时间】:2021-08-12 23:27:27
【问题描述】:

我希望两段文本在水平方向上彼此相等,直到屏幕变得太小,然后右侧的文本会滑到左侧的下方,因此它们会垂直堆叠。是像使用 flexbox 还是 display 一样简单?

有点像这样:

 ________________________________
|text A <--------------> text B  |
|________________________________|
 _______
|text A|
|text B|
|______|

我正在尝试仅在 css 中完成此操作。

谢谢

【问题讨论】:

    标签: javascript css flexbox


    【解决方案1】:

    您正在寻找flexboxflex-wrap 属性:

    .row {
      width: 100%;
      display: flex;
      justify-content:space-between;
      flex-wrap: wrap;
    }
    <div class="row">
      <div class="column">
        <h1>Text A</h1>
      </div>
      <div class="column">
        <h1>Text B</h1>
      </div>
    </div>

    【讨论】:

      猜你喜欢
      • 2020-02-01
      • 2019-09-04
      • 2022-01-24
      • 2023-03-11
      • 2021-07-13
      • 2020-09-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多