search

Home  >  Q&A  >  body text

前端 - 关于一个响应式的布局的问题?

一个页面,一行放5个元素(横向布局)。
1,怎样让这些元素在页面尺寸不断变小的时候width不变,而之间的margin不断变小。
2,怎样让这些元素在页面尺寸不断变小的时候width变小,而之间的margin不变呢。

我以前都是百分比布局,不知这种效果该如何实现?

迷茫迷茫2786 days ago927

reply all(13)I'll reply

  • PHPz

    PHPz2017-04-17 12:10:35

    You deserve flex layout

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 12:10:35

    One more thing to add, written in JS.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 12:10:35

    You should make the percentage grid a separate container, and place the list items inside the grid, then fix the width of its internal infrastructure. The margin will naturally change with the change of the large container, otherwise the spacing will be fixed. Then everything is solved, no need for flex layout or anything like that

    reply
    0
  • Cancelreply