0

我尝试了一种解决方法来正确定位具有边框半径的 div 内的一些图像。我需要将图像向左移动 1px,向顶部移动 1px,并且我使用了 jQuery .offset() 函数。它可以在 firefox、opera 和 IE 上正常工作,但不能在 chorme 上工作。

代码如下

$(window).load(function(){
    // adjust social icons
    $("div.nuvola.social img").each(function(){
        var tmpOffset = $(this).offset();
        tmpOffset.left -= 1;
        tmpOffset.top -= 1;
        $(this).offset(tmpOffset);  
    });
});

我在这个测试页面上传了一个例子(右上角的社交图标) 链接

4

1 回答 1

0

也许...

http://nieto.hostingplaza.org/cory/css/style.css(线路:76-82)

div.nuvola.social img {
    position: relative;
    height: 70px;
    width: 70px;
    left: -1px;
    top: -1px;
}

不要忘记添加“px”;

于 2012-04-19T02:26:51.600 回答