图像分辨率的 CSS 尺寸正确,但无法在浏览器中正确显示

发布于 2024-11-18 14:00:04 字数 1025 浏览 3 评论 0原文

我有一个网页布局设置,并且尺寸为 1920x1200 屏幕分辨率。

正确的页面显示设计如下:

http://cl.ly/3Q0I2R0q0q1E3v230k3w

不幸的是,渲染似乎看起来更像这样(在每个浏览器中,不仅仅是 IE,通过网络表达式超级预览查看图像): http://cl.ly/0Z2K3s3Q462s163v0303

以下是 div 标签的 CSS:

#gsquare
{
    width: 1366px;
    height: 927px;
    position: absolute;
    top: 14%;
    left: 15%;
    background-image: url("../images/1920x1200/gradientsquare.png");
    background-repeat: no-repeat;

    z-index: 15;
}

#wsquare
{
    width: 1326px;
    height: 900px;
    position: absolute;
    top: 1.5%;
    left: 1.5%;
    background-image: url("../images/1920x1200/whitesquare.png");
    background-repeat: no-repeat;
}

顶部和底部渐变背景每个像素高度为 171px。中心渐变方块设置为 1366x927,白色方块设置为 1326x900,依此类推。从我所看到的来看,这些数字确实在数学上相加,所以我不明白这里发生了什么。另外,我无法在该网站上使用 CSS3,因为 CSS3 中的大多数选择器仍处于 WD 状态。这是不允许的。

任何有关此问题的建议将不胜感激。请用代码详细说明您的解释,因为视觉辅助工具在这些情况下非常有帮助。

I have a set-up for a webpage layout and I did it for the dimensions 1920x1200 screen resolution.

The proper page display was designed to look like this:

http://cl.ly/3Q0I2R0q0q1E3v230k3w

Unfortunately, the rendering seems to look more like this (in every browser, not just IE, image viewed via web expression super preview):
http://cl.ly/0Z2K3s3Q462s163v0303

Here's the CSS for the div tag for these:

#gsquare
{
    width: 1366px;
    height: 927px;
    position: absolute;
    top: 14%;
    left: 15%;
    background-image: url("../images/1920x1200/gradientsquare.png");
    background-repeat: no-repeat;

    z-index: 15;
}

#wsquare
{
    width: 1326px;
    height: 900px;
    position: absolute;
    top: 1.5%;
    left: 1.5%;
    background-image: url("../images/1920x1200/whitesquare.png");
    background-repeat: no-repeat;
}

The top and bottom gradient backgrounds have a pixel height of 171px each. The center gradient square is set to 1366x927, the white square 1326x900, so on and so forth. Those numbers do mathematically add up from what I'm seeing, so I don't understand what's happening here. Also, I cannot use CSS3 for this site as most of the selectors in CSS3 are still in WD status. It isn't allowed.

Any advise on this issue would be greatly appreciated. Please elaborate on your explanations with code as the visual aids are extremely helpful in these cases.

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

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

发布评论

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

评论(1

昵称有卵用 2024-11-25 14:00:04

我看了你的两张图片,看来你只需稍微改变一下位置就能得到想要的结果。如果没有可查看的代码(包括图像和所有支持标记),则很难确定问题是什么。

您确实意识到,

position: absolute;
top: 14%;
left: 14%;

position: absolute;
    top: 1.5%;
    left: 1.5%;

从顶部开始的位置与从:开始的位置不同 15% 的下降与 1.5% 的下降将产生两个不同的起点,因此您必须在计算中对此进行调整。

I looked at both of your images and it seems like you can simply change the positioning a bit more to get the desired result. Without having the code to look at though (including image and all supporting markup) it is difficult to say for certain what the problem is.

You do realize though that starting from:

position: absolute;
top: 14%;
left: 14%;

versus

position: absolute;
    top: 1.5%;
    left: 1.5%;

is different in terms of placement from the top. 15% down versus 1.5% down will yield two different starting points and so you will have to adjust for that in your calculations.

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