使用背景图像为李

Yas*_*sir 10 css

我正在使用背景图像<li>作为按钮,但它没有完全显示; 但是,当写文本然后显示.我不想写文本它已经打印在背景图像上.我无法设置宽度 - 我该如何解决这个问题?

#footernav li#footerlocation
{
    display: inline;
    padding-right: 20px;
    background-image: url(../images/ourlocation.jpg);
    background-repeat: no-repeat;
    background-position: 0 -.2em;
}
Run Code Online (Sandbox Code Playgroud)

Mat*_*ell 11

您的问题是将显示设置为内联.如果您想要背景和宽度,但还需要内联类型列表,请设置float:left.


sup*_*led 7

看一下下面的例子:

   ul#footernav li { 
        display:inline; 
        }
    ul#footernav li a{ 
        display:block; 
        width:155px;
        text-indent:-9999px;
        }
    ul#footernav li.footerlocation a{ 
        height:30px ; 
        background: url('images/image.jpg') bottom left no-repeat; 
        }
    ul#footernav li.footerlocation a:hover{ 
        height:30px ; 
        background: url(images/image.jpg) top left no-repeat; 
        }
Run Code Online (Sandbox Code Playgroud)