为什么网站内容的两侧经常有空格?

发布于 2024-09-06 13:20:51 字数 52 浏览 3 评论 0 原文

我观察到很多网站在页面两侧都留有一些空格。其背后的原因是什么?它是网页设计标准的一部分吗?

I have observed that many sites have left some spaces on both sides of the page. What is the reason behind it? Is it a part of web design standards?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

前事休说 2024-09-13 13:20:52

我的偏好是使用液体布局达到某个合理的宽度(例如 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.

岁月流歌 2024-09-13 13:20:52

如果文本不接触窗口边缘,则更容易阅读文本。

It's easier to read text if it isn't touching the edges of a window.

内心旳酸楚 2024-09-13 13:20:52

页面两面都有空白。这是因为您为页面设置了特定尺寸并将其居中对齐以确保访问者看到它。

另一方面,有一些尺寸被广泛使用,例如你可以看到很多宽度为 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.

天邊彩虹 2024-09-13 13:20:51

您通常希望内容能够在所有合理尺寸的显示器上合理显示,而不需要水平滚动。实现此目的的一种方法是确保您的内容宽度不超过一定数量的像素(例如,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?).

若水般的淡然安静女子 2024-09-13 13:20:51

嗯,我能想到一个可能存在也可能不存在的好地方,那就是 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").

蹲墙角沉默 2024-09-13 13:20:51

这是关于固定布局与流动布局的争论。有很多讨论涉及这个主题。仅举几例:

简而言之:

固定宽度

固定的网站布局有一个固定宽度的包装器,其中的组件具有百分比宽度或固定宽度。重要的是容器(wrapper)元素设置为不移动

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

A fixed website layout has a wrapper that is a fixed width, and the components inside it have either percentage widths or fixed widths. The important thing is that the container (wrapper) element is set to not move

Fluid width

In a fluid website layout, also referred to as a liquid layout, the majority of the components inside have percentage widths, and thus adjust to the user’s screen resolution.

Your question was regarding the fixed layout and its pros, to name a few:

  • Fixed-width layouts are much easier
    to use and easier to customize in
    terms of design.
  • Widths are the same for every
    browser, so there is less hassle with
    images, forms, video and other
    content that are fixed-width.
  • There is no need for min-width or
    max-width, which isn’t supported by
    every browser anyway.
  • Even if a website is designed to be
    compatible with the smallest screen
    resolution, 800×600, the content will
    still be wide enough at a larger
    resolution to be easily legible

.

绿萝 2024-09-13 13:20:51

通常,您通过 css 将网站“包装器”置于屏幕中间:

#wrapper { width:960px; margin:0 auto; }

<div id="wrapper">content</div>

Usually you center your website "wrapper" in the middle of the screen through css:

#wrapper { width:960px; margin:0 auto; }

<div id="wrapper">content</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文