How to line up HTML input elements?

后端 未结 9 1424
滥情空心
滥情空心 2020-12-24 14:15

I am hoping to find a resource for lining up input elements in a HTML page. I find it difficult to get a select element and a text box to be the same width even when using t

9条回答
  •  情话喂你
    2020-12-24 14:44

    If you desperately need { width: 100%; } and not specified with widths in pixels, then jQuery is your friend:

    $(function () {
        var allSelects = $('input[type="text"], textarea');
        allSelects.css('width', (allSelects.width()-6)+'px');
    }
    

    -6 pixels works best for me (FF9), edit as you see fit.

提交回复
热议问题