2011-06-14 17 views
-2

私は背景を持つ垂直メニューを持っています。バックグラウンドを右から中央に移動する必要がありますが、これはできません。 http://www.tiikoni.com/tis/view/?id=b0b07d2css li背景の問題

ul.nav 
{ 
margin:0; background-position:center; background-image: url(../images/nav_bg.gif);font-family: "Century Gothic"; height:40px; padding-left:30px; 
} 
ul.nav a{ 
height:19px;color:white;display:inline-block;font-family:Century Gothic,Arial;font- size:14px;padding:8px 20px 0 ;text-decoration:none !important;vertical-align:middle; 
} 
ul.nav a:hover 
{ 
color:white;display:inline-block;font-family:Century Gothic,Arial;font-size:14px;height:19px;background-image: url(../images/nav_over.gif); 
background-position: center top;background-repeat: no-repeat;text-decoration:none !important;vertical-align:middle; 
} 
* html ul.nav a 
{ 
color:white;display:inline-block;font-family:Century Gothic,Arial;font-size:14px;height:19px;text-decoration:none !important;vertical-align:middle; 
} 
ul.nav a.highlight{ 
color:white;display:inline-block;font-family:Century Gothic,Arial;font-size:14px;height:19px;text-decoration:none !important;vertical-align:middle; 
} 
ul.nav li{ 
    display: inline; 
    color:#FFF; 
    background-image: url(../images/white_dotline.gif); 
    background-repeat: no-repeat; 
    background-position:right center; 
    font-size:14px; 
    padding:8px 1px; 
    font-family:"Century Gothic"; 
    height:19px; 
    [height:19px; 
    height:20px;]/*Google Chrome, Opera and newer Safary 4+*/ 
    } 

答えて

0

あなたはそれがhorisontal位置決めのために使われている、および垂直位置を50%に設定されていることを意味し、背景の位置、1つの値を指定しています。両方の位置を制御するには、2つの値を指定する必要があります。例:

background-position: left center; 
1

水平および垂直位置をbackground-positionプロパティによって制御されます。最初の数字はの水平の位置を定義し、2番目の数字はの垂直の位置を定義します。

言葉は、leftrightcenterとして水平に使用することができ、垂直ことがtopbottom及びcenterあります。 ピクセルまたはemsなどの絶対的な位置、さらにの割合など、絶対的な位置も使用できます。例えば

background-position: right top; /* positioned to the right and the top */ 
background-position: 100% 0; /* positioned 100% to the right and zero from the top (the same as above) */ 
background-position: 50px 200px; /* positioned 50px from the left and 100px from the top */