bootstrap4中怎么設置模態(tài)框,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
模態(tài)框是覆蓋在父窗體上的子窗體。通常,目的是顯示來自一個單獨的源的內(nèi)容,可以在不離開父窗體的情況下有一些互動。子窗體可提供信息交互等。
例如,通過點擊按鈕打開模態(tài)框。(推薦學習:Bootstrap視頻教程)
<!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中怎么設置模態(tài)框問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識。
文章名稱:bootstrap4中怎么設置模態(tài)框-創(chuàng)新互聯(lián)
當前URL:http://chinadenli.net/article2/ioiic.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、微信公眾號、品牌網(wǎng)站建設、App設計、小程序開發(fā)、ChatGPT
聲明:本網(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)
猜你還喜歡下面的內(nèi)容