2015-06-22 76 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()左上方; –