The alert box is a system object, and not subject to CSS. To do this style of thing you would need to create an HTML element and mimic the alert() functionality. The jQuery UI Dialogue does a lot of the work for you, working basically as I have described: Link.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#dialog" ).dialog();
  } );
  </script>
</head>
<body>
 
<div id="dialog" title="Basic dialog">
  <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
 
 
</body>
</html>

Answer from PCasagrande on Stack Overflow
๐ŸŒ
SitePoint
sitepoint.com โ€บ javascript
Yes / No Confirm Alert Box - JavaScript - SitePoint Forums | Web Development & Design Community
December 30, 2005 - Is there a predefined way to display a Message to the user giving them a Yes and No button that is as easy to code as Alert in JavaScript? What I what to do is provide the user a confirm box after the click the delete bโ€ฆ
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-edit-a-javascript-alert-box-title
How to Edit a JavaScript Alert Box Title ? - GeeksforGeeks
August 5, 2025 - We can't directly modify the title of the alert box because the title is controlled by the browser and cannot be changed by JavaScript.
Discussions

messages - Javascript Alert Box - User Experience Stack Exchange
Good day, The javascript alert box always shows up at the top of the page and it prevents any other interaction with the page until it is closed by clicking the OK button or pressing ESC. Because of More on ux.stackexchange.com
๐ŸŒ ux.stackexchange.com
January 28, 2019
How can I make a custom javascript alert() box like the one in the snap website? - Advanced Topics - Snap! Forum
Ik this is offtopic but I'm making a website and I want to make a custom alert box like the one in the snap website ex: More on forum.snap.berkeley.edu
๐ŸŒ forum.snap.berkeley.edu
0
July 31, 2022
How to edit a JavaScript alert box title? - Stack Overflow
I'm generating a JavaScript alert with following code in C# .NET page: Response.Write(" "); It displays an alert box More on stackoverflow.com
๐ŸŒ stackoverflow.com
javascript - HTML - Alert Box when loading page - Stack Overflow
i'm using HTML code and i wan't to show un Alert Message or alert box, i don't know what it is called, but a message with a "OK" button. i want to show this alert when the page is loaded. How do ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_popup.asp
JavaScript Popup Boxes
The window.alert() method can be written without the window prefix. ... A confirm box is often used if you want the user to verify or accept something.
๐ŸŒ
TutorialsTeacher
tutorialsteacher.com โ€บ javascript โ€บ display-popup-message-in-javascript
JavaScript Message Boxes: alert(), confirm(), prompt()
JavaScript provides built-in global functions to display popup message boxes for different purposes. alert(message): Display a popup box with the specified message with the OK button.
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ API โ€บ Window โ€บ alert
Window: alert() method - Web APIs | MDN
window.alert() instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog.
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ jsref โ€บ met_win_alert.asp
Window alert() Method
The alert() method displays an alert box with a message and an OK button.
๐ŸŒ
Js
alertbox.js.org
AlertBox - A simple, beautiful, responsive, easy to use, customizable text for JavaScript's Alert Box.
AlertBox - A simple, beautiful, responsive, easy to use, customizable text for JavaScript's Alert Box.
๐ŸŒ
Quackit
quackit.com โ€บ javascript โ€บ javascript_alert_box.cfm
JavaScript Alert Box
When a JavaScript alert box is triggered, a small box will pop up and display the text that you specify in your JavaScript code.
๐ŸŒ
Adobe
acrobatusers.com โ€บ tutorials โ€บ popup_windows_part1
The alert box: Part 1 of 5 on popup windows
June 7, 2008 - It displays short text messages (errors, warnings, etc.) and asks yes/no questions. Try it out by running the following code in the JavaScript Console. ... This statement displays a Popup Window with the words โ€œHello Worldโ€ and an info Icon (Figure 1). Figure 1 ย– Alert Box used as an information popup
๐ŸŒ
Penn State
accessibility.psu.edu โ€บ scripts โ€บ alertboxes
Accessibility at Penn State | Alert Boxes
September 15, 2018 - The link includes an onClick event which opens an alertbox when it is clicked on or the user clicks the ENTER button when the cursor is at the link. This works because browsers add a keyboard interpretation and also because the A tag includes a dummy href=โ€#โ€ URL. This allows all devices to recognize the link as a link. Note: When using JavaScript click events, it is important to verify that they also work with a keyboard or add a keyboard version.
๐ŸŒ
Snap! Forum
forum.snap.berkeley.edu โ€บ advanced topics
How can I make a custom javascript alert() box like the one in the snap website? - Advanced Topics - Snap! Forum
July 31, 2022 - Ik this is offtopic but I'm making a website and I want to make a custom alert box like the one in the snap website ex:
๐ŸŒ
Telerik
telerik.com โ€บ blogs โ€บ how-to-do-javascript-alerts-without-being-a-jerk
How To Do JavaScript Alerts Without Being A Jerk
May 27, 2021 - The ONLY thing I took from that tutorial was that I could create a modal window in JavaScript with virtually zero effort on my part. What transpired next was several years of flagrant "alert abuse". I put alerts everywhere. Alerts, prompts, confirms - you name it.
๐ŸŒ
Uw
projects.accesscomputing.uw.edu โ€บ webd2 โ€บ student โ€บ unit5 โ€บ module2 โ€บ lesson1.html
Using JavaScript to Show an Alert
Most programming or scripting languages ... useful function that's native to JavaScript is the alert() function. This function will display text in a dialog box that pops up on the screen....
๐ŸŒ
Bootstrap
getbootstrap.com โ€บ docs โ€บ 5.0 โ€บ components โ€บ alerts
Alerts ยท Bootstrap v5.0
Alerts are available for any length of text, as well as an optional close button. For proper styling, use one of the eight required contextual classes (e.g., .alert-success). For inline dismissal, use the alerts JavaScript plugin.