全视口高度缩放 div 只是 css 没有 js...可能吗?
好的,我正在尝试缩放 div,并且高度始终是视口的高度。我将链接到我的示例,因为它需要一些解释。
www.madmediablitz.com/tv/precentdemo.html
上面的链接是我找到的最接近解决方案的链接,我希望这里有人会发现它很容易修复。我想要发生的是电视始终是视口的高度(在某种程度上,最小高度:~400px;最大高度:~700px;)。我在那里使用的代码基于 http://www.alistapart .com/articles/creating-intrinsic-ratios-for-video/。
www.madmediablitz.com/tv/precentdemo_alt.html
这是我不想发生的事情。如果您调整窗口大小,您会发现它不按比例缩放。
我已经尝试这两种方法大约两天了,但一直无法让它发挥作用。我确实在祈祷帮助,因为我认为这并不太复杂。
Ok, I'm trying to get a div to scale and the height is always the height of the viewport. I'm going to link to my examples as it needs some explaining.
www.madmediablitz.com/tv/precentdemo.html
The link above is the closest I've come to a solution and I'm hoping that someone here will find it simple to fix. What I want to happen is the tv to always be the height of the viewport (to a degree, min-height:~400px; max-height:~700px;). The code that I used there is based on http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/.
www.madmediablitz.com/tv/precentdemo_alt.html
This one is what I DON'T want to happen. IF you resize your window you will see it doesn't scale proportionally.
I've been trying both of these for about 2 days now and I haven't been able to get it to work. I'm literally praying for help as I think, this isn't too complicated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请看这个:
http://stanhub.com/how-to-make-div-element-100-height-of-browser-window-using-css-only/
就是这样。
Please see this:
http://stanhub.com/how-to-make-div-element-100-height-of-browser-window-using-css-only/
That's it.
阅读这篇文章。
Read this article.
我猜想,您可以以一种非常令人惊讶的方式使用绝对定位:
兼容的浏览器应该尝试尊重顶部和底部指令,实际上管理整个高度。
You can use absolute positioning in a quite surprising way I surmise:
A compliant browser should try to respect both the top and bottom directives, actually managing a full height.