如何使html元素与浏览器大小一起移动? [英] How to make html elements to move together with browser size?
本文介绍了如何使html元素与浏览器大小一起移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI家伙
我写了一个网站,它非常棒。
但是当我的浏览器最大化时,我遇到了一个问题,我的网站看起来很棒但是当我恢复浏览器尺寸时,我的元素从它的实际位置移开。
谢谢
HI guys
i wrote a website and its pretty amazing.
But i got a problem when my browser is maximize my website looks fantastic but when i restore down my browser size my elements moves from its real position.
thanks
推荐答案
这不是浏览器大小,但我希望我理解你的意思。
问题太模糊,无法认真讨论任何问题。
您可以使用属性window.innerWidth
和window.innerHeight
:
https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth [ ^ ],
https://developer.mozilla.org/en-US/docs/Web/API/Window/innerHeight [ ^ ]。
从你的问题来看,我无法确定你真的需要它。相反,你需要采用液体,流体或弹性设计。请查看我过去的答案:
网页屏幕分辨率(Cross Browser \ Cross Platform)问题 [ ^ ],
获取屏幕分辨率 [ ^ ]。
-SA
This is not "browser size", but I hope I understand what you mean.
The question is too vague to discuss anything seriously.
You can use the propertieswindow.innerWidth
andwindow.innerHeight
:
https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth[^],
https://developer.mozilla.org/en-US/docs/Web/API/Window/innerHeight[^].
From your question, I cannot be sure that you really need it. It's more likely that, instead, you need to embrace liquid, fluid or elastic design. Please see my past answers:
Webpage screen resolution (Cross Browser\Cross Platform) problem[^],
To Get Screen resolution[^].
—SA
这篇关于如何使html元素与浏览器大小一起移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文