輸入組里的有點不同,它需要多加一層元素,。 你要用 .input-group-btn 包住按鈕,這樣就會多出一個附加按鈕。注意:要用 .input-group-btn 包住按鈕而不是 .input-group-addon. 這是因為默認的瀏覽器樣式不能被覆蓋。.input-group-addon:附加一個內(nèi)容,具體使用見 bootstrap/輸入框/單選框與復(fù)選框. 效果圖: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <link rel="shortcut icon" href="../../docs-assets/ico/favicon.png"> <title>Navbar Template for Bootstrap</title> <link rel="stylesheet" href="../../css/bootstrap.min.css" type="text/css"></link> </head> <body> <div class="row"> <div class="col-sm-2"> <div class="input-group"> <!-- 附加的按鈕的內(nèi)容,span在文本框前面則附加按鈕在前,span在文本框后面,則附加按鈕在后面 --> <span class="input-group-btn"> <button type="button" class="btn btn-default">Go!</button> </span> <input type="text" class="form-control"/> </div><!-- /input-group --> </div><!-- /.col-lg-6 --> <div class="col-sm-6"> <div class="input-group"> <input type="text" class="form-control"> <span class="input-group-btn"> <button type="button" class="btn btn-default">Go!</button> </span> </div><!-- /input-group --> </div><!-- /.col-lg-6 --> </div> </body> <script type="text/javascript" src="../../js/jquery-2.0.0.min.js"></script> <script type="text/javascript" src="../../js/bootstrap.min.js"></script> </html> |
|