html – 在响应式设计中将顶部元素移动到底部的最佳方式是什么?

html – 在响应式设计中将顶部元素移动到底部的最佳方式是什么?,第1张

概述我有以下 HTML格式,将给定元素放置在桌面顶部,移动设备底部(宽度< 640pxels)上的有效方式是什么?由于有很多不同的设备,我不想写入位置坐标,因为页面高度的内容有所不同.有什么建议么? <html><head>..</head><body>..<p>I am on the top of desktop page, and bottom of mobile page</p>. 我有以下 HTML格式,将给定元素放置在桌面顶部,移动设备底部(宽度< 640pxels)上的有效方式是什么?由于有很多不同的设备,我不想写入位置坐标,因为页面高度的内容有所不同.有什么建议么?
<HTML><head>..</head><body>..<p>I am on the top of desktop page,and bottom of mobile page</p>...</body></HTML>
解决方法 以灵活的方式重新排列未知高度的元素最好用FlexBox完成.虽然支持不是桌面浏览器(IE是这里的主要限制因素,支持从v10开始),大多数移动浏览器确实支持它.

http://cssdeck.com/labs/81csjw7x

@media (max-wIDth: 30em) {  .container {    display: -webkit-Box;    display: -moz-Box;    display: -ms-flexBox;    display: -webkit-flex;    display: flex;    -webkit-Box-orIEnt: vertical;    -moz-Box-orIEnt: vertical;    -webkit-flex-direction: column;    -ms-flex-direction: column;    flex-direction: column;    /* optional */    -webkit-Box-align: start;    -moz-Box-align: start;    -ms-flex-align: start;    -webkit-align-items: flex-start;    align-items: flex-start;  }  .container .first {    -webkit-Box-ordinal-group: 2;    -moz-Box-ordinal-group: 2;    -ms-flex-order: 1;    -webkit-order: 1;    order: 1;  }}

http://caniuse.com/#feat=flexbox

请注意,FlexBox可能会与其他布局方法冲突,例如典型的网格技术.设置为浮动的Flex项目可能会导致使用2009年规范(显示:-webkit-Box)的Webkit浏览器中出现意想不到的结果.

总结

以上是内存溢出为你收集整理的html – 在响应式设计中将顶部元素移动到底部的最佳方式是什么?全部内容,希望文章能够帮你解决html – 在响应式设计中将顶部元素移动到底部的最佳方式是什么?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1142201.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-31
下一篇2022-05-31

发表评论

登录后才能评论

评论列表(0条)

    保存