固定宽度网站是唯一真正的可能性吗?

发布于 2024-09-28 14:48:41 字数 261 浏览 2 评论 0原文

创建网站设计时,提供固定内容宽度是唯一真正的选择吗?

我注意到大多数主要网站(包括这个网站)将所有内容集中到固定宽度,这确保所有元素在所有屏幕尺寸上看起来都是正确的。

我想我已经知道这个问题的答案,但一位同事似乎认为永远不应该有水平滚动条,并且网站应该调整大小以适应用户的屏幕宽度。我认为文本可以调整大小,但其他元素不能(按钮、文本框等),因此固定宽度是唯一的选择。

我很想听听你的意见。

当然,固定宽度是保证所有浏览器上正确布局的唯一方法吗?

When creating a web-site design, is the only real option to provide a fixed content width?

I notice most major websites (this one included) center all the content into a fixed width, which ensures all elements look correct on all screen sizes.

I think I already know the answer to this, but a colleague seems to think that there should never be a horizontal scrollbar and a website should resize to the users screen width. I make the argument that text can resize but other elements can’t (buttons, textboxes etc), so a fixed width is the only option.

I'd love your opinions each way.

Surely fixed width is the only way you can guarantee the correct layout on ALL browsers?

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

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

发布评论

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

评论(5

沫尐诺 2024-10-05 14:48:41

您可以巧妙地利用浮动/媒体查询,使布局在较窄的宽度下正常工作。

但使用固定宽度确实更常见:

  • 设计更容易
  • 现在没有多少人拥有窄显示器 - 大多数网站似乎假设他们有 1000 像素的水平空间可以使用,我还没有听说过其中有很多人抱怨
  • 基于触摸的操作系统(iOS、Android 等)使缩放网页感觉非常自然,因此像素尺寸在那里并不那么重要。
  • 当内容行太宽时(我认为超过大约 60 个单词?),它们会变得难以阅读,因此对于拥有较大浏览器窗口的用户来说,将元素扩展到全宽并没有多大优势。

我认为最有可能拥有较少水平空间的用户群体是智能手机用户,如果您非常关心他们的体验,您将需要针对他们的特定设计。

哦,只有一件事:“固定宽度肯定是保证所有浏览器上正确布局的唯一方法吗?”恕我直言,这是程序员思考问题的方式。您无法保证有关网页渲染的任何事情。浏览器和操作系统可以为所欲为。这就是网络。放手吧。

You can get clever with floats/media queries to make layouts work well at narrower widths.

But it is indeed more common to go with a fixed width:

  • It’s easier to design
  • Not many people have narrow monitors these days — most websites seem to assume they’ve got 1000 pixels of horizontal space to work with, and I haven’t heard of them getting many complaints
  • Touch-based OSs (iOS, Android et. al) make zooming web pages feel very natural, so pixel dimensions aren't quite as important there.
  • When lines of content get too wide (I think more than around 60 words?), they get difficult to read, so there’s not much advantage to be gained from having elements expand to full width for users who have bigger browser windows.

I think the most likely group of users to have less horizontal space available is smartphone users, and you’re going to want a specific design for them if you care that much about their experience.

Oh, just one thing though: “Surely fixed width is the only way you can guarantee the correct layout on ALL browsers?” With the greatest possible respect, that’s a bit of a programmer’s way to think about it. You can’t guarantee anything about web page rendering. Browsers and operating systems can do whatever they want. That’s the web. Let it go.

橘虞初梦 2024-10-05 14:48:41

动态宽度网站通常由一个或多个百分比宽度块组成,总计 100%。因此块大小会随着分辨率或浏览器大小的调整而变化,但如果总宽度太短,可能会出现清晰度问题,因此为 指定了最小宽度,在这种情况下会出现水平滚动条。
但你可以有不同的想法:http://www.smashingmagazine。 com/2008/08/14/will-horizo​​ntal-layouts-return/

Dynamic-width web-sites are generally composed of one or many percentage-width blocks which make 100% total. So blocks size change with resolution or browser resizing, but if total width is too short it can occure lisibility problems, so a minimal width is specified for <body>, in which case a horizontal scrollbar appears.
But you can think differently : http://www.smashingmagazine.com/2008/08/14/will-horizontal-layouts-return/.

顾铮苏瑾 2024-10-05 14:48:41

我倾向于让我的网站具有最小宽度以提高可读性,但除此之外,宽度还根据窗口大小的百分比确定(我通常选择 80%)。

我发现这给了我足够的视口覆盖范围,同时在更大的显示器上看起来仍然不错。

我发现当内容很少时,这种方法在较大的屏幕上会失败,因为内容往往会在页面顶部拉伸成一行,这会使事情变得混乱。因此,对于这些页面,最好采用固定宽度、居中的样式。

I tend to make my websites have a minimum width for legibility, but otherwise the width is determined as a percentage of the window size (I normally pick 80%).

I find this gives me ample coverage of the viewport, whilst still looking good on larger monitors.

I find this approach fails on larger screens when there is little content, as the content tends to get stretched into a line at the top of the page, which can make things confusing. So for those pages it can be good to have a fixed width, centred style.

2024-10-05 14:48:41

不,一千次不。

如果您的网站呈现任何类型的正文,固定宽度是 90 年代中期的令人厌恶的东西,它迫使读者疯狂地滚动,同时被大片未使用的屏幕空间嘲笑为任一尺寸。 (现在,我可能会购买不同数量的。)

顺便说一句:CW 标志。

No. A thousand times no.

If your website presents any kind of body text, fixed width is an abomination from the depths of the mid-90s, forcing readers to scroll like crazy, while being mocked by vast expanses of unused screen space to either size. (Now, a variable number of columns I might buy.)

BTW: flag for CW.

最冷一天 2024-10-05 14:48:41

水平滚动条是一个大问题。正确设计的网站应该能够缩小以在小分辨率屏幕 (640x480) 上使用。另外,为了浏览网站而必须将浏览器窗口最大化也很好。此外,拥有高分辨率显示器的人没有理由不能利用显示器提供的额外空间。

Horizontal scrollbars are a big problem. A properly designed website should be able to scale down to be used on small resolution screens (640x480). Also, it's nice to have to have my browser window maximized just to browse a site. Also, there's no reason why a person with a high resolution monitor shouldn't be able to use the extra space their monitor gives them.

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