2015-12-31 33 views
2

Salaamun Alekum引導不當表格格式化

我改變引導Form類從form-horizontalform-inline和所有格式不安我怎樣才能得到正確的內聯格式化

以前 Before Inline

直列後 After inline

這是示例代碼與第一個表單域

<div class="form-horizontal"> 

    <hr /> 
    @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 
    <div class="form-group"> 
     <label class="control-label col-md-2" for="Med_Name">Medicine Name</label> 
     <div class="col-md-10"> 
      @Html.EditorFor(model => model.Med_Name, new { htmlAttributes = new { @class = "form-control" } }) 
      @Html.ValidationMessageFor(model => model.Med_Name, "", new { @class = "text-danger" }) 
     </div> 
    </div> 
    @* Rest Of The HTML Code Is Not Shown *@ 

謝謝

+0

能否請您分享您的HTML? –

+1

見。當你設置'inline'嘗試也以正確的'COL-MD-*'類來包裝根據自己的需要.. :) –

+1

當然@AliJamal我會用一些細節.. :) –

回答

3

當您設置風格inline你還需要將其包裝在各自的UI模式說..結束語前3 textboxescol-md-4然後包裝所有這3個textboxescol-md-12父爲他們..甚至你可以嘗試把它包在row元素,每次3 textboxes或者按您的要求。

例:

<div class="col-md-12"> <!--Even row instead of col-md-12--> 
    <div class="form-group col-md-4"> <!--col-md-4 for other elements too--> 
     <label class="control-label col-md-2" for="Med_Name">Trade Price</label> 
     <div class="col-md-10"> 
      @Html.EditorFor(model => model.Med_Name, new { htmlAttributes = new { @class = "form-control" } }) 
      @Html.ValidationMessageFor(model => model.Med_Name, "", new { @class = "text-danger" }) 
     </div> 
    </div> 

    <!--Same goes for other 2 elements--> 
</div> 
<div class="col-md-12"> <!--Even row instead of col-md-12--> 
    <div class="form-group col-md-4"> 
     <label class="control-label col-md-2" for="Med_Name">Medicine Name</label> 
     <div class="col-md-10"> 
      @Html.EditorFor(model => model.Med_Name, new { htmlAttributes = new { @class = "form-control" } }) 
      @Html.ValidationMessageFor(model => model.Med_Name, "", new { @class = "text-danger" }) 
     </div> 
    </div> 

    <!--Same goes for other 2 elements--> 
</div> 
0

Salaamun Alekum 我用col-md-*隨着form-inline類作爲@GuruprasadRao提到在評論http://j.mp/3112071208

謝謝@GuruprasadRao

現在格式化是更漂亮 Prettier Formatting

謝謝

+1

沒有'同事md- *'就像在@Ali中一樣。'* *'意味着來自'1-12'的任何值。請參閱我發佈在答案中的示例。 –