How can I make my <input type=“submit” /> an image?

前端 未结 6 1657
不知归路
不知归路 2021-02-02 11:07

I have a beautiful little CSS image that needs to be a button. I\'ve tried about 20 different methods, none of which work. I just either get a blank nothing or a border with no

6条回答
  •  北海茫月
    2021-02-02 11:31

    HTML :

    From css class
    From HTML tag

    CSS :

    .btn{
        display: inline-block;
     background:url(http://cdn.sstatic.net/stackexchange/img/favicon.ico);
        position: relative;
        border-radius: 5px;
    }
    .input{
        background: transparent;
        color: #fff;
        border: 0;
        padding-right: 20px;
        cursor: pointer;
        position: relative;
        padding: 5px 20px 5px 5px;
        z-index: 1;
    }
    

    JS Fiddle : http://jsfiddle.net/AJNnZ/26/

提交回复
热议问题