CSS का उपयोग करके विभिन्न रंगों और शैलियों के टेक्स्ट बटन बनाए जा सकते हैं। इस उदाहरण में पांच अलग-अलग प्रकार के बटन (Success, Info, Warning, Danger, Default) दिखाए गए हैं जिनमें होवर इफेक्ट भी शामिल है।
उदाहरण
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
button {
border: none;
color: white;
font-weight: bolder;
padding: 20px;
font-size: 18px;
cursor: pointer;
border-radius: 6px;
}
.Success { color: #4caf50; }
.Success:hover { background: #e7e7e7; }
.Info { color: #2196f3; }
.Info:hover { background: #e7e7e7; }
.Warning { color: #ff9800; }
.Warning:hover { background: #e7e7e7; }
.Danger { color: #f44336; }
.Danger:hover { background: #e7e7e7; }
.Default { color: black; }
.Default:hover { background: #e7e7e7; }
</style>
</head>
<body>
<h1>Text Buttons Example</h1>
<button class="Success">Success</button>
<button class="Info">Info</button>
<button class="Warning">Warning</button>
<button class="Danger">Danger</button>
<button class="Default">Default</button>
</body>
</html>
आउटपुट
उपरोक्त कोड निम्नलिखित आउटपुट उत्पन्न करेगा:

मुख्य बिंदु
- border: none - डिफ़ॉल्ट बॉर्डर हटाता है
- वर्ग-आधारित स्टाइलिंग - प्रत्येक बटन प्रकार के लिए अलग क्लास
- होवर इफेक्ट - सभी बटनों के लिए समान हल्का ग्रे बैकग्राउंड
- बॉर्डर-रेडियस - कोनों को थोड़ा गोल करता है