CSS: Submit button looks smaller than text input and textarea

后端 未结 5 1902
广开言路
广开言路 2021-01-02 12:07

I just noticed this strange rendering of a very simple form.

Here\'s my markup/CSS: http://jsfiddle.net/a9PLM/

As you can see, text fields and the button sha

5条回答
  •  死守一世寂寞
    2021-01-02 12:31

    The problem is that the form parts are generally not rendered like normal HTML elements, and styling them is always a bit hit-or-miss. I would attempt to avoid a case like this that requires exact sizing, but if you can't, then split the selectors like this:

        form textarea, form input[type=text]
        {
            width:250px;
            padding:10px;
        }
        form input[type=submit] { width: 270px }
    

    Note that I added 20 px (10 x 2) to the width to compensate for padding.

提交回复
热议问题