अलर्ट मैसेज में लाल बैकग्राउंड, सफेद टेक्स्ट, क्लोज बटन (×) होता है। क्लोज बटन पर इनलाइन JS onclick="this.parentElement.style.display='none'" से अलर्ट छुप जाता है।
उदाहरण
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.alertMessage {
padding: 20px; background-color: #f44336; color: white; font-size: 20px;
}
.close {
margin-left: 15px; color: white; font-weight: bold; float: right;
font-size: 22px; line-height: 20px; cursor: pointer; transition: 0.3s;
}
.close:hover { color: black; }
</style>
</head>
<body>
<h1>Alert Message Example</h1>
<div class="alertMessage">
<span class="close" onclick="this.parentElement.style.display='none';">×</span>
<strong>This cannot be reverted!</strong> Your account will be deleted.
</div>
</body>
</html>
आउटपुट
उपरोक्त कोड निम्नलिखित आउटपुट उत्पन्न करेगा:

मुख्य बिंदु
- लाल बैकग्राउंड - #f44336 (मटेरियल रेड) खतरे/चेतावनी के लिए
- क्लोज बटन - × एंटिटी, फ्लोट राइट, होवर पर काला
- इनलाइन JS - पैरेंट को display: none करता है
- ट्रांजिशन - क्लोज बटन होवर पर 0.3s
- स्ट्रॉन्ग टेक्स्ट - महत्वपूर्ण भाग बोल्ड
- नोट - स्थायी डिस्मिस के लिए localStorage/कुकीज़ जोड़ें