How do I set the size of an HTML text box?

前端 未结 11 1800
广开言路
广开言路 2020-12-23 13:00

How do I set the size of an HTML text box?

相关标签:
11条回答
  • 2020-12-23 13:34

    Your textbox code:

    <input type="text" class="textboxclass" />
    

    Your CSS code:

    input[type="text"] {
    height: 10px;
    width: 80px;
    }
    

    or

    .textboxclass {
    height: 10px;
    width: 80px;
    }
    

    So, first you select your element with attributes (look at first example) or classes(look last example). Later, you assign height and width values to your element.

    0 讨论(0)
  • 2020-12-23 13:35

    Elements can be sized with the height and width attributes.

    0 讨论(0)
  • 2020-12-23 13:36

    Just use:

    textarea {
        width: 200px;
    }
    

    or

    input[type="text"] {
        width: 200px;
    }
    

    Depending on what you mean by 'textbox'.

    0 讨论(0)
  • 2020-12-23 13:36

    You can make the dependent input width versus container width.

    .container {
       width: 360px;
    }
    
    .container input {
       width: 100%;
    }
    
    0 讨论(0)
  • 2020-12-23 13:37
    input[type="text"]
    {
        width:200px
    }
    
    0 讨论(0)
提交回复
热议问题