CSS 定位问题 - 右侧位置间歇性地起作用

发布于 2024-12-10 08:58:16 字数 700 浏览 0 评论 0原文

我有一个真正困扰我的问题:我编写了一些在大多数情况下都可以正常工作(正如我所期望的)的 css,但有时却无法正常工作。再进一步看,似乎并不是每次都显示正确的属性。这是代码:

input.search-lupe { 
position: relative; 
top: 318px; 
right: -915px; 
background: url(../images/lupe.png) no-repeat; 
width: 22; height: 23; border: 0; 
padding: 0 38px 0 10px; 
z-index: 201; } 

就像我说的,大多数时候,它可以正常工作,但有时却不能,我可以看到这是因为每次都没有显示正确的属性。我觉得这很奇怪。回顾一下,当元素显示错误时,我检查了 Firebug 中的代码,这就是我所看到的:

input.search-lupe { 
position: relative; 
top: 318px; 
background: url(../images/lupe.png) no-repeat; 
width: 22; height: 23; border: 0; 
padding: 0 38px 0 10px; 
z-index: 201; }

该问题发生在同一浏览器中(Firefox 7、Mac 有时有效,有时无效。Safari 5 Mac 也是如此) 。有什么想法吗?

I've got an issue that is really bugging me: I wrote some css that works fine (as I expected) most of the time, however intermittently it doesn't. Looking further, it seems that the right property is not displayed every time. Here's the code:

input.search-lupe { 
position: relative; 
top: 318px; 
right: -915px; 
background: url(../images/lupe.png) no-repeat; 
width: 22; height: 23; border: 0; 
padding: 0 38px 0 10px; 
z-index: 201; } 

Like I said, most of the time, it works as it should, however sometimes it doesn't and I can see that it is because of the right property is not being displayed every time. It seems very odd to me. Just to recap, when the element is displayed wrongly, I check the code in Firebug and that's what I see:

input.search-lupe { 
position: relative; 
top: 318px; 
background: url(../images/lupe.png) no-repeat; 
width: 22; height: 23; border: 0; 
padding: 0 38px 0 10px; 
z-index: 201; }

The issue happens in the same browser (Firefox 7, Mac sometime works, sometimes doesn't. The same with Safari 5 Mac). Any ideas?

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

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

发布评论

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

评论(1

沩ん囻菔务 2024-12-17 08:58:16

也许这不是你的问题,但你不应该在 width: 22; 之后添加 px高度:23;

Maybe it's not your problem but shouldn't you add px after width: 22; height: 23;?

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