为什么网站内容的两侧经常有空格?
我观察到很多网站在页面两侧都留有一些空格。其背后的原因是什么?它是网页设计标准的一部分吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我观察到很多网站在页面两侧都留有一些空格。其背后的原因是什么?它是网页设计标准的一部分吗?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
我的偏好是使用液体布局达到某个合理的宽度(例如 1024 像素),然后使用固定宽度。有关如何执行此操作的更多信息和代码,请参阅:如何优化网页宽度。
My preference is to use liquid layout up to some reasonable width (say 1024 pixels), after which use fixed width. For more info and code explaining how to do this, see: How to optimize web page width.
如果文本不接触窗口边缘,则更容易阅读文本。
It's easier to read text if it isn't touching the edges of a window.
页面两面都有空白。这是因为您为页面设置了特定尺寸并将其居中对齐以确保访问者看到它。
另一方面,有一些尺寸被广泛使用,例如你可以看到很多宽度为 950px、1000px 和 995px 的网站,这是因为一个常见的规律是在 1024 分辨率下为你的网站提供更好的外观。
There is space in both side of the pages. this is because you set a specific size for your page and align itto center to make sure your visitor see it.
On the other hand, there are some size which using widely, fore example you can see lots of websites with 950px, 1000px and 995px width, it is because of a common law that provide a better look for your website in 1024 resolution.
您通常希望内容能够在所有合理尺寸的显示器上合理显示,而不需要水平滚动。实现此目的的一种方法是确保您的内容宽度不超过一定数量的像素(例如,800x600 显示器为 760 左右,如果您希望将 1024x768 作为最小显示器尺寸,则为 960 左右)。
另一种选择是“液体”布局,可以拉伸到浏览器窗口的大小,但这些布局通常更难编码,并且对于非常大的显示器来说通常同样不受欢迎(人们真的希望网站拉伸到 1900x1200 分辨率吗?)。
You typically want your content to display reasonably on all reasonable sized monitors without requiring horizontal scrolling. One way of doing this is to make sure your content goes no wider than a certain number of pixels (say 760 ish for 800x600 monitors or 960ish if you want to target 1024x768 as your minimum monitor size).
The other option is "liquid" layouts that stretch to the browser window's size, but these are typically harder to code and are often equally undesirable for very large monitors (do people really want a website to be stretched across a 1900x1200 resolution?).
嗯,我能想到一个可能存在也可能不存在的好地方,那就是 StackOverflow ;-) 但无论如何:那是因为人们可以更轻松地阅读长度不超过 68 个字符的文本行。 (或者类似的东西)人眼一次只能看到这么多,如果你让你的文本太宽,人们一旦越过右边就会失去对左边的跟踪,这使得更难阅读。基本上,您希望文本的整个宽度适合一个视野(对于“视野”的某些定义)。
Hmm, I can think of a good place for this that may or may not exist yet, that is not StackOverflow ;-) But anyway: that's because people have an easier time reading lines of text that are no more than 68 characters long. (Or something like that) The human eye can only take in so much at a time, and if you make your text too wide, people will lose track of the left side of the line once they get over to the right side, which makes it harder to read. Basically, you want the entire width of the text to fit within one field of view (for some definition of "field of view").
这是关于
固定布局与流动布局
的争论。有很多讨论涉及这个主题。仅举几例:简而言之:
固定宽度
Fluid width
您的问题是关于固定布局及其优点,仅举几例:
使用和更容易定制
设计条款。
浏览器,所以麻烦更少
图像、表格、视频和其他
固定宽度的内容。
最大宽度,不支持
无论如何,每个浏览器。
兼容最小的屏幕
分辨率,800×600,内容将
在更大的情况下仍然足够宽
分辨率要容易辨认
。
Its the debate about
fixed Vs fluid
layouts. There are plenty of discussions which cover this topic. To name a few:In a nutshell:
Fixed width
Fluid width
Your question was regarding the fixed layout and its pros, to name a few:
to use and easier to customize in
terms of design.
browser, so there is less hassle with
images, forms, video and other
content that are fixed-width.
max-width, which isn’t supported by
every browser anyway.
compatible with the smallest screen
resolution, 800×600, the content will
still be wide enough at a larger
resolution to be easily legible
.
通常,您通过 css 将网站“包装器”置于屏幕中间:
Usually you center your website "wrapper" in the middle of the screen through css: