奇怪(?)歌剧漂浮

发布于 2024-08-01 19:35:50 字数 1572 浏览 1 评论 0原文

我在 Opera 上有一些奇怪的浮动行为(IE f 完全不同,但那是稍后的事)。 我将 i 图标浮动到右侧。 它在 Fx 和 WebKit 上运行良好,但 Opera 将图标向下移动了一点。 有人知道这是怎么发生的吗?

CSS:

.dataRow {
    margin: 5px 0;
    clear:right;
}
.dataRow label{
    display: block;
    float:left;
    width: 160px;
    vertical-align: middle;
    font-size: 80%;
}
.dataGroup a img {
    border:0;float:right;
    position:relative;
    right:0;
}
.dataGroup a:hover {
    background:#EBEDC7;
    text-decoration:none;
}
.dataGroup a.tooltip span {
    display:none;
    padding:2px 3px;
    margin-top:20px;
    width:100px;
    font-size: 80%;
 }
.dataGroup a.tooltip:hover span {
    display:inline;
    position:absolute;
    border:1px solid #632D11;
    background:#C2BD6C;
    color:#fff;
}

HTML:

<fieldset class="dataGroup">
<div class="dataRow"><label>Foobar:</label> <input name="foobar" size="10" value="somedata" /> <a href="#" class="tooltip"><img src="/img/admin/information.png"/><span>Tooltip Info</span></a></div>
</fieldset>

“火狐”

Webkit http://img197.imageshack.us/img197/3269/webkit.jpg

歌剧 http://img41.imageshack.us/img41/112/operaf.jpg

I have some strange floating behaviour on opera (IE f's up completely different, but that's for later).
I'm floating the i-icons to the right. It works nicely on Fx and WebKit, but opera shifts the icons down a bit. Anyone got an idea how this happenes?

CSS:

.dataRow {
    margin: 5px 0;
    clear:right;
}
.dataRow label{
    display: block;
    float:left;
    width: 160px;
    vertical-align: middle;
    font-size: 80%;
}
.dataGroup a img {
    border:0;float:right;
    position:relative;
    right:0;
}
.dataGroup a:hover {
    background:#EBEDC7;
    text-decoration:none;
}
.dataGroup a.tooltip span {
    display:none;
    padding:2px 3px;
    margin-top:20px;
    width:100px;
    font-size: 80%;
 }
.dataGroup a.tooltip:hover span {
    display:inline;
    position:absolute;
    border:1px solid #632D11;
    background:#C2BD6C;
    color:#fff;
}

HTML:

<fieldset class="dataGroup">
<div class="dataRow"><label>Foobar:</label> <input name="foobar" size="10" value="somedata" /> <a href="#" class="tooltip"><img src="/img/admin/information.png"/><span>Tooltip Info</span></a></div>
</fieldset>

FireFox

Webkit http://img197.imageshack.us/img197/3269/webkit.jpg

Opera http://img41.imageshack.us/img41/112/operaf.jpg

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

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

发布评论

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

评论(3

空城缀染半城烟沙 2024-08-08 19:35:50

如果您使用伪选择器 :after,如下所示:

.dataRow:之后  
  {       
      内容: ”。”;   
      显示:块;   
      高度:0;   
      明确:两者;   
      可见性:隐藏; 
  } 

这应该可以修复 Opera,而且我认为 IE8 也支持 :after。

无耻借用
位置就是一切

If you use the pseudo selector :after, like so :

.dataRow:after 
{      
    content: ".";  
    display: block;  
    height: 0;  
    clear: both;  
    visibility: hidden;
}

That should fix Opera, and of the top of my head, I believe IE8 also supports :after.

Shamelessly borrowed from
Position is everything

心的位置 2024-08-08 19:35:50

你使用任何CSS重置代码吗? 从我的角度来看,你似乎在一些基本元素上得到了额外的填充。

只是为了好玩,请尝试删除 dataGroup 内所有元素的填充和边距,然后再手动设置它们。

.dataGroup *
{
    margin: 0px;
    padding: 0px;
}
...
.dataRow...

Are you using any css reset code? Off the top of my head it seems like you're getting extra padding on some of your basic elements.

Just for kicks and giggles, try removing the padding and margins on all of your elements inside dataGroup, before setting them manually.

.dataGroup *
{
    margin: 0px;
    padding: 0px;
}
...
.dataRow...
水波映月 2024-08-08 19:35:50

解决此问题的唯一方法是在 HTML 中的输入之前添加浮动图像。 不幸的是,当在它应该浮动的元素之后声明它时,Opera 仍然将 float:right 放在新行上。

http://bytes.com/topic/html -css/answers/587691-float-right-goes-next-line

The only way to fix this is have the floating image before the input in your HTML. Unfortunately, Opera still puts a float:right on a new line when it's declared after the element it should float next to.

http://bytes.com/topic/html-css/answers/587691-float-right-goes-next-line

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