CSS.Is is posible to place one element at center of flexbox and one at the right side (large screen) ; but both at center in column in mobile devices?

huangapple go评论68阅读模式
英文:

CSS.Is is posible to place one element at center of flexbox and one at the right side (large screen) ; but both at center in column in mobile devices?

问题

将内容放入 flexbox 中,以使在较大的显示屏上查看时两个单元格并排显示,但在较小的屏幕上(即移动设备)查看时,将这两个元素都居中于视口中,这样可以使我的Web应用程序更具响应性吗?

例如,

  1. 在较大的屏幕/视口上,应如下所示:

CSS.Is is posible to place one element at center of flexbox and one at the right side (large screen) ; but both at center in column in mobile devices?

  1. 在较小的屏幕/视口上(即移动设备),应如下所示:

CSS.Is is posible to place one element at center of flexbox and one at the right side (large screen) ; but both at center in column in mobile devices?

谢谢大家。我搞不定。

英文:

Is it possible to make my web app more responsive by placing content in a flexbox such that two cells are side-by-side when viewed on larger displays, but then have both of these elements centered in a single column in the viewport when viewed on smaller screens (i.e., mobile devices)?

For example,

  1. On larger screens/viewports it should look like this:

CSS.Is is posible to place one element at center of flexbox and one at the right side (large screen) ; but both at center in column in mobile devices?

  1. On smaller screens/viewports (i.e., mobile) it should look like this:

CSS.Is is posible to place one element at center of flexbox and one at the right side (large screen) ; but both at center in column in mobile devices?

Thank you all. I can't figure it out.

答案1

得分: 0

使用媒体查询

@media (max-width: 600px)

并设置

flex-direction: column

英文:

Use a media-query

@media (max-width: 600px) 

and set

flex-direction: column

huangapple
  • 本文由 发表于 2023年6月26日 16:23:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76554855.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定