button image as form input submit button?

前端 未结 6 1232
孤独总比滥情好
孤独总比滥情好 2020-12-01 08:37
<
相关标签:
6条回答
  • 2020-12-01 09:18

    Make the submit button the main image you are using. So the form tags would come first then submit button which is your only image so the image is your clickable image form. Then just make sure to put whatever you are passing before the submit button code.

    0 讨论(0)
  • 2020-12-01 09:19

    You could use an image submit button:

    <input type="image" src="images/login.jpg" alt="Submit Form" />
    
    0 讨论(0)
  • 2020-12-01 09:20

    This might be helpful

    <form action="myform.cgi"> 
     <input type="file" name="fileupload" value="fileupload" id="fileupload">
     <label for="fileupload"> Select a file to upload</label> 
     <br>
     <input type="image" src="/wp-content/uploads/sendform.png" alt="Submit" width="100"> </form>
    

    Read more: https://html.com/input-type-image/#ixzz5KD3sJxSp

    0 讨论(0)
  • 2020-12-01 09:21

    You can also use a second image to give the effect of a button being pressed. Just add the "pressed" button image in the HTML before the input image:

    <img src="http://integritycontractingofva.com/images/go2.jpg" id="pressed"/>
    <input id="unpressed" type="submit" value=" " style="background:url(http://integritycontractingofva.com/images/go1.jpg) no-repeat;border:none;"/>
    

    And use CSS to change the opacity of the "unpressed" image on hover:

    #pressed, #unpressed{position:absolute; left:0px;}
    #unpressed{opacity: 1; cursor: pointer;}
    #unpressed:hover{opacity: 0;}
    

    I use it for the blue "GO" button on this page

    0 讨论(0)
  • 2020-12-01 09:30

    Late to the conversation...

    But, why not use css? That way you can keep the button as a submit type.

    html:

    <input type="submit" value="go" />
    

    css:

    button, input[type="submit"] {
        background:url(/images/submit.png) no-repeat;"
    }
    

    Works like a charm.

    EDIT: If you want to remove the default button styles, you can use the following css:

    button, input[type="submit"]{
        color: inherit;
        border: none;
        padding: 0;
        font: inherit;
        cursor: pointer;
        outline: inherit;
    }
    

    from this SO question

    0 讨论(0)
  • 2020-12-01 09:30
    <div class="container-fluid login-container">
        <div class="row">
            <form (ngSubmit)="login('da')">
                <div class="col-md-4">
                        <div class="login-text">
                            Login
                        </div>
                        <div class="form-signin">
                                <input type="text" class="form-control" placeholder="Email" required>
                                <input type="password" class="form-control" placeholder="Password" required>
                        </div>
                </div>
                <div class="col-md-4">
                    <div class="login-go-div">
                        <input type="image" src="../../../assets/images/svg/login-go-initial.svg" class="login-go"
                             onmouseover="this.src='../../../assets/images/svg/login-go.svg'"
                             onmouseout="this.src='../../../assets/images/svg/login-go-initial.svg'"/>
                    </div>
                </div>
            </form>
        </div>
    </div>
    

    This is the working code for it.

    0 讨论(0)
提交回复
热议问题
User ID: