2011-06-14 86 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 */