gpt4 book ai didi

html - 在 Chrome/Safari 中缩小到 80% 以下时填充不会缩小

转载 作者:行者123 更新时间:2023-11-28 04:29:04 25 4
gpt4 key购买 nike

我一直在用脑袋敲 table ,想弄清楚为什么会这样。我已经设置了一个在顶部、底部和左侧都有填充的 anchor 。该 anchor 内有两个文本元素, anchor 的背景是一张图片。

现在,当我在 chrome 中缩小(而不是缩小视口(viewport))时,一切似乎都按预期缩小,直到我达到 80%。此时内容继续缩小但左侧的填充没有!在 FireFox 中,它似乎按预期工作。

附件是我的代码,如有任何关于如何解释的想法,我们将不胜感激。

html {font-family: 'tex gyre heros', helvetica, arial, sans-serif; font-weight: normal; font-style: normal; font-size: 10px}

a,a:link,a:visited,a:hover {text-decoration: none; color: inherit;}

.logo {
padding: 10em 10em 0 0;
background: url(../images/some-image.svg) left center no-repeat;
display: inline-block;
vertical-align: bottom;
}
.logo.main {
padding: 1.2em 0 2.1em 12em;
}
.logo.main .logotype, .logotype.block {
display: block;
}
.logotype {
font-weight: bold;
white-space: nowrap;
}
.logotype.title {
font-size: 4em;
line-height: 1.1;
color: #646469;
}
.logotype.subtitle {
padding: 0 0 0 0.078em;
font-size: 2.1em;
line-height: 1.1;
color: #000000;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="Company">
<base href="">
<title>Company</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen" charset="utf-8"/>
<link rel="stylesheet" href="css/fonts.css" type="text/css" media="screen" charset="utf-8"/>
<link rel="stylesheet" href="css/default.css" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
<header>
<a class="logo main" href="">
<span class="logotype title">Line 1</span>
<span class="logotype subtitle">Line 2</span>
</a>
</header>
<section>
</section>
<footer></footer>
</body>
</html>

最佳答案

这里的问题来自浏览器之间像素表示的差异。含义 - Chrome 和 Firefox 可能会以不同方式处理一些固定像素值(不要问我为什么,这就是世界如何处理一切)。

Possible solution 1: Try and set the padding values in % so that they can be relative to each other.

Possible solution 2: This thread on CSS Tricks about not breaking the layout when zooming:

Possible solution 3: Check your viewport tags. Use this thread.

就像@DarkxPunk 所说的那样,该链接在 Firefox 上位于最左侧,而在 Chrome 中却不会位于最左侧。

发布可视化以供进一步调查:

Chrome:

enter image description here

火狐:

enter image description here

关于html - 在 Chrome/Safari 中缩小到 80% 以下时填充不会缩小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41821425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com