无法跨越背景图像来完整显示

发布于 2024-12-24 19:37:00 字数 507 浏览 1 评论 0原文

我有一张图像,无论屏幕尺寸如何,我都想完整显示。我在 Photoshop 中提取图像以渲染其大小(它最初为 4164 x 2667,因为它是矢量)并对其进行一些更改。

我将图像缩小到大约 1200 x 769 并将其保存为 PNG 格式。然而,整个图像没有在我的显示器上正确显示 - 它似乎将其拉伸到屏幕之外并切断了背景的很大一部分。

这是原始图像:

在此处输入图像描述

这是我在 jsbin 上使用的代码的链接,用于尝试出来:

http://jsbin.com/uyirah/2/edit

你可以看到如果你渲染图像的代码没有完全显示。关于可能导致这种情况的任何想法?我的 CSS 不好吗?

另外,最终图像使用什么尺寸来减少延迟时间比较合适?

I have an image that I would like to show in full regardless of screen size. I pulled up the image in Photoshop to render its size (it was originally 4164 x 2667 since it was a vector) and make some changes to it.

I downsized the image to about 1200 x 769 and saved it as a PNG. However, the entire image is not displaying properly on my monitor - it seems to be stretching it beyond the screen and cutting off a good portion of the background.

Here is the original image:

enter image description here

and here is a link to the code I used on jsbin to work with trying it out:

http://jsbin.com/uyirah/2/edit

You can see that if you render the code the image doesn't fully display. Any ideas on what might causing this? Is my CSS bad?

Also, what would be a good size to use for the final image as to reduce lag time?

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

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

发布评论

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

评论(1

满身野味 2024-12-31 19:37:00

您在 css 中为背景大小指定“cover”。这表明您希望图像缩放以使其完全覆盖背景,即使这会在一维上截断一些图像。

如果您希望图像在背景中尽可能大地显示,请尝试“包含”而不是“覆盖”...

You are specifying "cover" for background-size in your css. This indicates that you want the image to scale so that it completely covers the background, even if this cuts off some of the image in one dimension.

If you want the image to show completely as large as possible in the background, try "contain" instead of "cover"...

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