How to edit the size of the submit button on a form?

后端 未结 10 813
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-24 05:13

Hi I don\'t want an image for my submit button so I have gone with the default submit button but I want to edit its width and height. How do I do that?



        
相关标签:
10条回答
  • 2020-12-24 05:45

    just use style attribute with height and width option

    <input type="submit" id="search" value="Search"  style="height:50px; width:50px" />
    
    0 讨论(0)
  • 2020-12-24 05:48

    You can change height and width with css:

    #search {
         height: 100px;
         width: 400px;
    }
    

    It's worth pointing out that safari on OSX ignores most input button styles, however.

    0 讨论(0)
  • 2020-12-24 05:49

    Using CSS.

    Either inside your <head> tag (the #search means "the element with an ID of search")

    <style type="text/css">
        input#search
        {
            width: 20px;
            height: 20px;
        }
    </style>
    

    Or inline, in your <input> tag

    <input type="submit" id="search" value="Search"  style="width: 20px; height: 20px;" />
    
    0 讨论(0)
  • 2020-12-24 05:51

    That's easy! First, give your button an id such as <input type="button" value="I am a button!" id="myButton" /> Then, for height, and width, use CSS code:

    .myButton {
        width: 100px;
        height: 100px;
    }
    

    You could also do this CSS:

    input[type="button"] {
        width: 100px;
        height: 100px;
    }
    

    But that would affect all the buttons on the Page.

    Working example - JSfiddle

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