警告框消息显示在一行中

Alert box message to be displayed in one line

在 JavaScript 中,我希望在一行中显示一条警告消息(更改警告框的大小而不是将消息分成多行)。有办法吗?

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

警告框是一个系统对象。您无法修改其样式。 (我猜这不容易)。 如果您想要可自定义的警报,请查看 bootbox: http://bootboxjs.com/

您不能通过纯 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"); });