Displaying command button with image only

后端 未结 4 555
小鲜肉
小鲜肉 2020-12-15 07:34

I am trying to display a button with image only on my page but all I see is the button with ^. Following is the code for my button:



        
4条回答
  •  死守一世寂寞
    2020-12-15 07:45

    The image attribute has to refer a CSS class name, not a plain CSS property. So, this should do:

     
    

    with the following in your CSS:

    .someCssClassName {
        background-image: url(images/title_logo.jpg)
    }
    

    Please note that I fixed the major typo in property name and also removed the leading slash from the image URL, it would otherwise be resolved relative to the site's domain root; the above expects the title_logo.jpg to be inside an /image folder which in turn is in the folder where the CSS file resides.

    However, this one is less clumsy, I think:

    
        
    
    

提交回复
热议问题