iPhone 浏览器向某些 DIV 添加右侧边距

发布于 2025-01-08 12:55:31 字数 362 浏览 1 评论 0原文

我正在整理的网站应如下所示: GB 个人训练

这是 iPhone 上的样子: iPhone 浏览器

如您所见,它推送到 #wrap 和 #outer -wrap DIV,以便其中的背景图像有右边距,我不知道为什么。我只能访问 custom.css 文件,不能访问 HTML。

我目前正在编辑它的克隆: gbptclone.live.subhub.com/

This is how the site I'm putting together should look:
GB Personal Training

This is what it looks like on the iPhone:
iPhone Browser

As you can see it pushes in the #wrap and #outer-wrap DIVs, so that the background images in them have a right margin and I don't know why. I only have access to the custom.css file and not the HTML.

I'm currently editing a clone of it at:
gbptclone.live.subhub.com/

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

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

发布评论

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

评论(3

我做我的改变 2025-01-15 12:55:31

body 中定义 max-width。像这样写:

body {
    min-width: 1000px;
}

将其添加到 HTMLhead 中:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

Define max-width in your body. Write like this:

body {
    min-width: 1000px;
}

add this inside your HTMLhead:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
寂寞清仓 2025-01-15 12:55:31

实际上,这将阻止用户缩放内容(从用户端体验来看,这很糟糕):

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

相反,在我看来(我不是专家),您应该使用:

<meta name="viewport" content="width=1000px">

Actually this will prevent the user to zoom the content (wich sucks, from an user end experience):

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

Instead, in my opinion (and I am no guru), you should use:

<meta name="viewport" content="width=1000px">
我三岁 2025-01-15 12:55:31

尝试设置 #outer_wrap 和 #wrap 的宽度(您可能需要 100%)。

看起来 Mobile Safari 正在扩大 #visual-portal-wrapper div 的大小,但这还不够,因为 Safari 会调整 iPhone 显示的文本大小。您可以使用 -webkit-text-size-adjust: none; 更改此设置但对于 iPhone 用户来说,这会使链接变得相当小。这就是为什么它适合普通浏览器但不适合 Mobile Safari。

更改 div 的宽度应该阻止它们的内容扩展到其边缘之外(默认情况下它们是 974px,因为这就是#visual-portal-wrapper,但所有内容溢出并导致视觉错误)并具有背景图像出现被切断的情况。您可能还想为 #outer_wrap 添加背景定位,因为它在屏幕截图上与我在 Firefox 中看到的略有不同。

编辑:或者,您可以尝试更改宽度:974px;将 #visual-portal-wrapper div 设置为 min-width: 974px;,当然要确保考虑到 IE 的 min-width 问题)。

Try setting a width for #outer_wrap and #wrap (you probably want 100%).

It looks like Mobile Safari is expanding the size of the #visual-portal-wrapper div, which isn't enough because Safari resizes text for iPhone display. You can change this with -webkit-text-size-adjust: none; but that would make the links rather undersized for iPhone users. That's why it fits in a normal browser but not in Mobile Safari.

Changing the width of the divs should stop them from having content expand beyond their edges (they're 974px by default because that's what #visual-portal-wrapper is, but all the contents overflow and cause the visual errors) and have the background images appear cut off. You might also want to add background positioning for #outer_wrap since it appears slightly off on the screenshot from what I'm seeing in Firefox.

Edit: Alternatively, you could try changing the width: 974px; on the #visual-portal-wrapper div to min-width: 974px;, of course making sure you account for IE's problems with min-width).

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