2016-04-22 94 views
-1

我在我的網站上有一個header-div。在標題內部,我希望在右側有一個登錄表單。右側的自舉輸入插件

CSS:

#header { 
    position: absolute; 
    top: 0; 
    width: 100%; 
    height: 45px; 
    padding: 5; 
    background: #fff; 
    border-bottom: 1pt solid #ccc; 
    text-align: right; 
    font-weight: bold; 
} 

#header div { 
    /*display: inline-block;*/ 
    cursor: pointer; 
    /*padding: 4px;*/ 
    float: right; 
    text-decoration: none; 
    font-size: 15px; 
    margin-right: 5px; 
} 

#submitButton { 
    float:right; 
} 

HTML:

<div id="header"> 
<div id="login"> 
    <form class="form-inline" role="form"> 
<div class="row"> 
    <button type="submit" class="btn btn-default" id="submitButton">Login</button> 
    <div class="form-group col-sm-3"> 
     <div class="input-group"> <span class="input-group-addon"><i class="fa fa-envelope-o fa-fw"></i></span> 

      <input type="email" class="form-control" placeholder="Enter email" /> 
     </div> 
    </div> 
    <div class="form-group col-sm-3"> 
     <div class="input-group"> <span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span> 

      <input type="password" class="form-control" placeholder="password" /> 
     </div> 
    </div> 
</div> 
</form> 
</div> 
</div> 

這是我到目前爲止有: http://jsfiddle.net/n5qmc/254/

但是,如果我在密碼錶單,然後按TAB去我沒有進入電子郵件輸入字段。由於浮動:正確的事情。我需要做到這點不同。

這樣做的正確方法是什麼?謝謝!

+0

嘗試shift +選項卡,你得到了你的答案:p –

+0

那麼你的代碼不好。在大屏幕上的密碼是第一次,但因爲我們將調整密碼是秒然後tab-index會改變他們的工作.. –

+0

你想在右側的插件圖標? –

回答

1

你需要的是tabindex,但由於你的html不好,並且在bootstrap中你已經使用了你自己的風格,所以tabindex有不同的行爲。

我已更新您的fiddle html和css的變化。請檢查,並讓我知道如果它可以給你..

我已經刪除浮動,也刪除額外的利潤現在造成問題,現在如果你將使用選項卡,那麼它將逐一去,也將更好地調整大小。我也改變了HTML,所以在這兩種情況下,電子郵件字段將是第一個。

+0

問題是:我希望它在右側。 – progNewbie

+0

你想在右側做什麼? –

+0

整件事。所有輸入字段和按鈕。 – progNewbie