本文摘自PHP中文网,作者醉折花枝作酒筹,侵删。
警告框可以通过灵活的提供一些预定义信息,为用户反馈一些内容和提示。今天我们来介绍bootstrap警告框,有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。
警告框
将文本和一个可选择的按钮放在一起,就是一个警告框,使用警告框必须设置.alert
,还有其他的类可供选择。目前提供了成功、消息、警告或危险。
1 2 3 4 | < div class = "alert alert-success" role = "alert" >成功</ div >
< div class = "alert alert-info" role = "alert" >你有一条新消息</ div >
< div class = "alert alert-warning" role = "alert" >警告!!!</ div >
< div class = "alert alert-danger" role = "alert" >本次操作危险,是否继续?</ div >
|
![1617184022506861.png H`28EB6R9YG@I5CRF]{`B_U.png](http://ypimg.muzhuangnet.com/Collect/csharp/upload/image/477/697/123/1617184022506861.png)
可关闭警告框
在警告框中加入.
alert-dismissible
类和一个关闭按钮,则成为一个可以关闭的警告框。为了保证该操作可行,需要给 <button>
元素添加 data-dismiss="alert"
属性。
1 2 3 4 | < div class = "alert alert-warning alert-dismissible" role = "alert" >
< button type = "button" class = "close" data-dismiss = "alert" aria-label = "Close" >< span aria-hidden = "true" >×</ span ></ button >
< strong >警告!</ strong > 本次操作有风险,是否继续?
</ div >
|
![1617184315255016.png G36LWG71S8Z[BUV~]2)P[D3.png](http://ypimg.muzhuangnet.com/Collect/csharp/upload/image/628/588/635/1617184315255016.png)
警告中的链接
.alert-link
可以为链接设置与当前警告框相同的颜色。
1 2 3 4 5 6 7 8 9 10 11 12 | < div class = "alert alert-success" role = "alert" >
< a href = "#" class = "alert-link" >成功</ a >
</ div >
< div class = "alert alert-info" role = "alert" >
< a href = "#" class = "alert-link" >你有一条新消息</ a >
</ div >
< div class = "alert alert-warning" role = "alert" >
< a href = "#" class = "alert-link" >警告!!!</ a >
</ div >
< div class = "alert alert-danger" role = "alert" >
< a href = "#" class = "alert-link" >本次操作危险,是否继续?</ a >
</ div >
|
此次就不演示了,演示了图片也看不出,还是自己亲身实践比较好。
推荐学习:Bootstrap视频教程
以上就是一招搞定bootstrap警告框的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
如何使用bootstrap制作form表单
bootstrap的缓存问题怎么处理
bootstrap-switch如何设置初始值
不用bootstrap用什么
bootstrap icon 不显示怎么办
bootstrap怎么改字体
bootstrap怎么把div变成一个圆
bootstrap如何使用路径分页标签
使用bootstrap-table实现分页和排序
关闭bootstrap alert提示窗的实现方法
更多相关阅读请进入《bootstrap》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » 一招搞定bootstrap警告框