Label on the left side instead above an input field

前端 未结 15 901
太阳男子
太阳男子 2020-12-02 09:44

I would like to have the labels not above the input field, but on the left side.

15条回答
  •  星月不相逢
    2020-12-02 10:10

    You can see from the existing answers that Bootstrap's terminology is confusing. If you look at the bootstrap documentation, you see that the class form-horizontal is actually for a form with fields below each other, i.e. what most people would think of as a vertical form. The correct class for a form going across the page is form-inline. They probably introduced the term inline because they had already misused the term horizontal.

    You see from some of the answers here that some people are using both of these classes in one form! Others think that they need form-horizontal when they actually want form-inline.

    I suggest to do it exactly as described in the Bootstrap documentation:

    
      

    Which produces:

    enter image description here

提交回复
热议问题