创建适合任何屏幕分辨率的母版页
我创建了一个母版页,并且希望附加到它的 ASP.NET 页面适合任何屏幕分辨率。它是一个基于 html 表格的设计。
我读到,如果将表格宽度和高度保持为 100%,那么它应该适合任何分辨率。我做了同样的事情,它将宽度调整为任何屏幕分辨率,但不调整高度。我们看到底部有一个空白区域用于较高的屏幕分辨率,并为较低的屏幕分辨率创建一个滚动条。
有人知道如何解决这个问题吗?
I have created a masterpage and I want the ASP.NET pages attached to it to fit any screen resolution. Its a html tables based design.
I read that if you keep tables width and height to 100% then it should fit to any resolution. I have done the same thing, it adjusts its width to any screen resolution but not height. We see a blank space at the bottom for heigher screen resolutions and creates a scroll bar for lower screen resolutions.
Anyone has any idea how to fix this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为如果你想要高度,你必须使用javascript。
之后,您可以设置外部 div 的高度
I think if you want height, you have to use javascript.
After that, you can style your outer div's height
大多数开发人员想要修复的是宽度。
高度不是问题。你永远不会知道人们使用什么决议。相信我,这本身就是一个大问题。
所以,我建议你固定宽度并坐下来:D
What most developers want to fix is the width.
The height is not a problem. You'll never know what resolutions people use. Trust me, this is a BIG ISSUE by itself.
So, i recommend you to fix the width and sit back :D
您应该使用基于 DIV 的页面,而不是基于表格的页面。它通常很容易创建和处理。就高度而言,你不应该担心它,因为高度可能会随着内容的增加而增加。就我个人而言,每当我想要使用全宽度时,我都会将 HTML 分成三部分。
我保留 页眉和页脚 div 为正文宽度,而主要内容通常为 900 像素宽。我给出了全宽页面的漂亮干净的效果:)
希望它有帮助:)
Intstead of table based page you should go for DIV based pages.. Its generally easy to create and handle. As far as height is concerned, u shouldn't be worried about it as height may increase with the content.. Personally, whenever I want to go with full width, I break my HTML in three parts..
I keep eader and footer div to full body width while Main Content is normally 900px wide.. I gives nice clean effect of full width page :)
hope it helps :)
可能值得添加以帮助理解,在您描述的示例中,100% 高度属性将与内容相关,因为元素的高度将扩展和收缩以适合您选择插入的任何内容,如 UGS已经说过了。
如果您希望最大程度地减少高度太小的发生次数,可以使用“min-height”属性并以像素为单位定义它。例如,如果您知道预期目标设备的最小所需高度是 320 像素,则可以设置“min-height: 320 px”以确保在最小的设备上您不会看到下面的任何空间。
It might be worth adding to aid understanding that in the example you've described the 100% height property will be relative to the content, in that, the height of the element will expand and contract to fit whatever you choose to insert, as UGS has said.
You could, if you wish to minimise the amount of occurances where the height is too small, use the 'min-height' property and define this in pixels. If for example you knew your minimum desired height of intended target devices was 320px, you could set 'min-height: 320px' to ensure that on your smallest devices you wouldn't see any space below.