這篇文章給大家分享的是有關(guān)bootstrap4設(shè)置模態(tài)框的方法的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考。一起跟隨小編過來看看吧。
創(chuàng)新互聯(lián)建站專業(yè)為企業(yè)提供子長網(wǎng)站建設(shè)、子長做網(wǎng)站、子長網(wǎng)站設(shè)計、子長網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、子長企業(yè)網(wǎng)站模板建站服務(wù),10多年子長做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。
模態(tài)框是覆蓋在父窗體上的子窗體。通常,目的是顯示來自一個單獨的源的內(nèi)容,可以在不離開父窗體的情況下有一些互動。子窗體可提供信息交互等。
例如,通過點擊按鈕打開模態(tài)框。
<!DOCTYPE html> <html> <head> <title>Bootstrap 實例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css"> <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/popper.js/1.12.5/umd/popper.min.js"></script> <script src="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h3>模態(tài)框?qū)嵗?lt;/h3> <!-- 按鈕:用于打開模態(tài)框 --> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal"> 打開模態(tài)框 </button> <!-- 模態(tài)框 --> <div class="modal fade" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <!-- 模態(tài)框頭部 --> <div class="modal-header"> <h5 class="modal-title">模態(tài)框頭部</h5> <button type="button" class="close" data-dismiss="modal">×</button> </div> <!-- 模態(tài)框主體 --> <div class="modal-body"> 模態(tài)框內(nèi)容.. </div> <!-- 模態(tài)框底部 --> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">關(guān)閉</button> </div> </div> </div> </div> </div> </body> </html>
我們可以通過添加 .modal-sm 類來創(chuàng)建一個小模態(tài)框,.modal-lg 類可以創(chuàng)建一個大模態(tài)框。
尺寸類放在 <div>元素的 .modal-dialog 類后 :
感謝各位的閱讀!關(guān)于bootstrap4設(shè)置模態(tài)框的方法就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
當前名稱:bootstrap4設(shè)置模態(tài)框的方法
網(wǎng)站鏈接:http://vcdvsql.cn/article36/pdspsg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、定制網(wǎng)站、動態(tài)網(wǎng)站、網(wǎng)頁設(shè)計公司、網(wǎng)站排名、
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)