2016-09-01 72 views
1

我有在它下面的CSS代碼的引導方式。我試圖通過添加margin:0屬性來關閉表單中的空格,但仍然存在元素之間的空格。關閉空間的引導形式

CSS樣式代碼

<div class="row-fluid"> 
    <form style="width: 90%; height: 100%; margin-top:1px;" method="post"novalidate="novalidate" class="form well"> 


     <div class="row-fluid"> 
      <div> 
       <label for="complaints">Message *</label> 
       <textarea style="width:100%;" name="complaints" rows="3" required></textarea> 
      </div> 
     </div> 
     <div class="form-actions"> 
      <input style="width:100%; background-color:#da291c;" class="btn btn-primary" name="commit" type="submit" value="Send"> 
     </div> 
    </form> 
</div> 

這是上述格式的圖像

enter image description here

我的挑戰是關閉的地區差距與箭頭指出。

我使用這個版本的自舉

<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css"> 
+1

刪除保證金這一類「控制組」 –

回答

1

您可以刪除自舉margin-bottom增加了類.control-group

.row-fluid div.control-group, div.form-actions { 
    margin-bottom: 0px; 
} 

div.my-form{ 
    padding-bottom: 0px; 
    margin-top:0px; 
    padding-top:0px; 
} 

.control-group input,.control-group textarea{ 
     margin-bottom: 0px;  
} 

form.form{ 
    padding-bottom: 0; 
    padding-top:0; 
} 

修訂jsfiddle與您的代碼

+0

邊緣表單元素之間仍然存在,甚至在你撥弄 – Francis

+0

檢查它現在我編輯的jsfiddle –

+0

@Francis或者,如果你想沒有空間檢查這一個https://jsfiddle.net/dpjoe0Lt/13/ –

0

您可以使用此代碼:

input[type=text], .txtarea{ 
    margin-bottom: 10px; 
} 
0

在引導他們已經保持對總的保證金性質。我們可以覆蓋那個來解決你的問題。

你需要添加一個類是這樣的:

.splclass{ 
    margin:0 !important; 
    padding:0 !important; 
} 

形式內嵌樣式額外添加這樣的:

<form style="width: 90%; height: 100%; margin-top:1px; padding-top:5px;" method="post"novalidate="novalidate" class="form well "> 

我認爲這將有幫助

0

好吧,如果你不中間不需要任何空間,你絕對不需要任何保證金。移動CSS到它自己的文件:

.send { 
    width:100%; 
    background-color:#da291c; 
} 

.message { 
    width:100%; 
} 

.form { 
    width: 90%; 
    height: 100%; 
    margin: 0; 
} 

和HTML:

<div class="row-fluid"> 
    <form class="form" method="post" novalidate="novalidate" class="form well"> 

     <div class="row-fluid"> 
      <div class="control-group span12"> 
       <label for="name">Name *</label> 
       <input ng-model="name" name="name" type="text" class="input-block-level" required> 
      </div> 
     </div> 
     <div class="row-fluid"> 
      <div class="control-group span12"> 
       <label for="email">Email *</label> 
       <input name="email" placeholder="" type="email" class="input-block-level" ng-model="email"ng-change="id=email" required> 
      </div> 
     </div> 
     <div class="row-fluid"> 
      <div class="control-group span12"> 
       <label for="complaints">Message *</label> 
       <textarea class="message" name="complaints" rows="3" required></textarea> 
      </div> 
     </div> 
     <div class="form-actions"> 
      <input class="btn btn-primary send" name="commit" type="submit" value="Send"> 
     </div> 
    </form> 
</div> 

,你可以在這裏看到小提琴:https://jsfiddle.net/6j98311j/