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

后端 未结 10 812
佛祖请我去吃肉
佛祖请我去吃肉 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:31

    Using CSS you can set a style for that specific button using the id (#) selector:

    #search {
        width: 20em;  height: 2em;
    }
    

    or if you want all submit buttons to be a particular size:

    input[type=submit] {
        width: 20em;  height: 2em;
    }
    

    or if you want certain classes of button to be a particular style you can use CSS classes:

    <input type="submit" id="search" value="Search" class="search" />
    

    and

    input.search {
        width: 20em;  height: 2em;
    }
    

    I use ems as the measurement unit because they tend to scale better.

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

    Use the css height and width properties.

    For this to work on Mac, you also need to set the button's border to none.

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

    Change height using:

    input[type=submit] {
      border: none; /*rewriting standard style, it is necessary to be able to change the size*/
      height: 100px;
      width: 200px
    }
    
    0 讨论(0)
  • 2020-12-24 05:39

    I tried all the above no good. So I just add a padding individually:

     #button {
    
        font-size: 20px;
        color: white;
        background: crimson;
        border: 2px solid rgb(37, 34, 34);
        border-radius: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
        padding-right: 10px;
        padding-left: 10px;
     }
    
    0 讨论(0)
  • 2020-12-24 05:41

    Just add style="width:auto"

    <input type="submit" id="search" value="Search" style="width:auto" />

    This worked for me in IE, Firefox and Chrome.

    0 讨论(0)
  • 2020-12-24 05:44
    <input type="button" value="submit" style="height: 100px; width: 100px; left: 250; top: 250;">
    

    Use this with your requirements.

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