2011-06-14 170 views
-2

我有一個背景的垂直菜單。我需要將背景從右上方移到右上方,但無法做到這一點。 http://www.tiikoni.com/tis/view/?id=b0b07d2css李背景問題

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%的單個值。您應該指定兩個值來控制這兩個位置。示例:

background-position: left center; 
1

水平和垂直位置由background-position屬性控制。第一個數字定義了橫向的位置和第二個縱向的位置

字可以用於水平如leftrightcenter和垂直是topbottomcenter。也可以使用絕對位置,如像素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 */