2015-06-22 72 views
-2

我的背景图片出现后,此空间在哪里? (图像中的红色线表示间距) 背景图像没有这个空间,它到底哪里黑色结束......背景图片之后的距离

#menu{ 
    width:300px; 
    margin: 0; 
    padding: 0; 
    background:url(../img/menuBackground.png) right no-repeat; 
    color:rgba(255,255,255,1.00); 
} 

enter image description here

应该很好地和完全地去右边的div ...

+0

你能提供一个代码示例? – imtheman

+0

'#menu'的右边缘在哪里?版权日期元素的空间是多少?尝试在'#menu'元素周围添加一个边框,以确保边缘处于您期望的位置。 –

+0

介意创建一个JSFiddle? –

回答

1

这是我是谁感到困惑: 这解决了这个问题:

background:url(../img/menuBackground.jpg) right top no-repeat; 

因为只有图像的中间结果显示,它看起来好像有间距:enter image description here

2

尝试更改顶部:右:和高度:看看你想出了什么也添加位置固定,除非你有这个地方,我不知道你的代码的其余部分在哪里。

#menu 
    position:fixed; 
    top:0px; /*maybe try positioning it fixed where you want it*/ 
    right:0px; /*same here or left:0;*/ 
    width:300px; 
    height:250px; /*you could also try using height*/ 
    margin: 0; 
    padding: 0; 
    background:url(../img/menuBackground.png) right no-repeat; 
    color:rgba(255,255,255,1.00); 
    } 
+0

你让我觉得。 问题是机智的背景图像的位置: 这解决了我的问题: background:url(../ img/menuBackground.jpg)right top no-repeat; 鉴于我的形象高于菜单,我没有看到它是垂直对齐中间。 Becaus的对角线结束,似乎有一个间距 – Nomistake

+0

我有同样的问题有点类似,并用它来修复它之前哈哈,甚至没有通知 背景:url(../ img)无重复中心0,#000 url()左上方; –