javascript - 警报框消息显示在一行中

标签 javascript jquery html alert message

在 JavaScript 中,我希望警报消息出现在一行中(更改警报框的大小而不是将消息分成多行)。有办法做到这一点吗?

这是我现在收到的警报消息。邮件内容没问题。但是在“Stream Definition:”将显示在一行中之后,我想知道是否有任何可能的方法来显示消息的其余部分,即实际的流定义全部在一行中?

Current alert message

最佳答案

您无法通过纯 css 更改警报框的样式,因为它是前面提到的系统对象。

我有一些链接,您可以查看自定义警报框:

Stylish JavaScript Dialog (Alert, Confirm, Prompt) Boxes
Sweet alert <-- I prefer and use this one myself. It is really simple and looks really nice in my opinion.
boot box <-- has been mentioned before, it is quite nice but a little more advanced and more code
a tutorial by Adam Khoury <-- I don't know if you know this guy, but he is amazing in explaining coding stuff. He has a tutorial about Custom Alert Box Programming Tutorial

希望这对您有一点帮助。祝你好运,如果你有什么需要帮助的。请评论,我会尽力帮助您。

编辑:

您需要download the project
然后加载文件:
<script src="dist/sweetalert.min.js"></script>
<link rel="stylesheet" type="text/css" href="dist/sweetalert.css">

然后调用弹出窗口

swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", closeOnConfirm: false }, function(){ swal("Deleted!", "Your imaginary file has been deleted.", "success"); });

关于javascript - 警报框消息显示在一行中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37962344/

相关文章:

javascript - 用 ID_x 匹配 ID_x 或用 +i 循环遍历 id

jquery - 我怎样才能分开容器,以免它们在移动设备上重叠?

javascript - 在 jQuery 中使用 addClass 更改背景颜色

jquery - 在 jquery 中选择成对的 html 元素

html - 为什么不 !Important 在这里覆盖以前的设置

javascript - 如何在按钮单击时显示在 html 中实际未设置为 none 的 div?

javascript - 使用 AngularJS 在文本框中需要两个词

javascript - 从 javascript/jquery 读取文本框值

Javascript 打印函数 : Remove space from preview page

html - CSS 影响错误部分中的元素