2012-12-22 40 views
0

jsFiddleCSS - 錨定位背景圖像打破布局

我有連接到連接帶班selectedlink

的圖片展示了BG的形象,但我定位它,它就會消失外鏈接的視覺參數。這就像href是一個圖像的窗口。

下面的代碼:

CSS:

div#intnavIcons a.selectedlink { 
    color: #900404; 
    font-size:11px; 
    font-weight:bold; 
    padding:#FFF; 
    text-decoration:underline; 
    background: url("/images/nav/bg-nav-current.png") no-repeat scroll center bottom transparent; 
} 

HTML:

<div id="intnavIcons"> 
    <a class="selectedlink">This is selected</a> 
    <a>This is not selected</a> 
    <a>This is not selected</a> 
    <a>This is not selected</a> 
</div> 

任何人都可以看到,如果我失去了我的風格的東西來保持圖像的在href之上?

對於移動它越往下,我只是加入background-position: 0px 10px;

回答

2

背景圖像僅限於元素的框(具體框依賴於background-clip風格)。如果你想把它往下移,它會在它碰到盒子底部時開始消失。

你可能想嘗試加入padding-bottom:10px

我也注意到你有padding:#FFF,這是沒有意義的。你的意思是background-color

+0

嗯,不知道我是如何錯過'padding:#FFF',多麼尷尬。 嗯,你說得對,'padding-bottom'工作。 – coffeemonitor