एचटीएमएल संदर्भ

वर्णमाला द्वारा HTML श्रेणी के अनुसार HTML एचटीएमएल ब्राउज़र समर्थन एचटीएमएल गुण HTML वैश्विक गुण एचटीएमएल घटनाक्रम एचटीएमएल रंग एचटीएमएल कैनवास एचटीएमएल ऑडियो/वीडियो एचटीएमएल कैरेक्टर सेट एचटीएमएल सिद्धांत एचटीएमएल यूआरएल एनकोड एचटीएमएल भाषा कोड एचटीएमएल देश कोड HTTP संदेश HTTP तरीके पीएक्स से ईएम कन्वर्टर कुंजीपटल अल्प मार्ग


एचटीएमएल <बटन> टैग


उदाहरण

एक क्लिक करने योग्य बटन को निम्नानुसार चिह्नित किया जाता है:

<button type="button">Click Me!</button>

नीचे और अधिक "इसे स्वयं आज़माएं" उदाहरण।


परिभाषा और उपयोग

<button>टैग एक क्लिक करने योग्य बटन को परिभाषित करता है

एक <button>तत्व के अंदर आप टेक्स्ट (और टैग जैसे <i>, <b>, <strong>, <br>, <img>, आदि) डाल सकते हैं। <input>तत्व के साथ बनाए गए बटन के साथ यह संभव नहीं है !

युक्ति: ब्राउज़र को यह बताने के लिए कि वह किस प्रकार का बटन है, typeकिसी तत्व के लिए हमेशा विशेषता निर्दिष्ट करें ।<button>

युक्ति: आप CSS के साथ आसानी से बटनों को स्टाइल कर सकते हैं! नीचे दिए गए उदाहरणों को देखें या हमारे सीएसएस बटन ट्यूटोरियल पर जाएं।


ब्राउज़र समर्थन

Element
<button> Yes Yes Yes Yes Yes

गुण

Attribute Value Description
autofocus autofocus Specifies that a button should automatically get focus when the page loads
disabled disabled Specifies that a button should be disabled
form form_id Specifies which form the button belongs to
formaction URL Specifies where to send the form-data when a form is submitted. Only for type="submit"
formenctype application/x-www-form-urlencoded
multipart/form-data
text/plain
Specifies how form-data should be encoded before sending it to a server. Only for type="submit"
formmethod get
post
Specifies how to send the form-data (which HTTP method to use). Only for type="submit"
formnovalidate formnovalidate Specifies that the form-data should not be validated on submission. Only for type="submit"
formtarget _blank
_self
_parent
_top
framename
Specifies where to display the response after submitting the form. Only for type="submit"
name name Specifies a name for the button
type button
reset
submit
Specifies the type of button
value text Specifies an initial value for the button

वैश्विक गुण

<button>टैग HTML में वैश्विक विशेषताओं का भी समर्थन करता है


घटना गुण

<button>टैग HTML में ईवेंट विशेषताओं का भी समर्थन करता है



और ज्यादा उदाहरण

उदाहरण

स्टाइल बटन के लिए CSS का उपयोग करें:

<!DOCTYPE html>
<html>
<head>
<style>
.button {
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}

.button1 {background-color: #4CAF50;} /* Green */
.button2 {background-color: #008CBA;} /* Blue */
</style>
</head>
<body>

<button class="button button1">Green</button>
<button class="button button2">Blue</button>

</body>
</html>

उदाहरण

स्टाइल बटन के लिए CSS का उपयोग करें (होवर प्रभाव के साथ):

<!DOCTYPE html>
<html>
<head>
<style>
.button {
  border: none;
  color: white;
  padding: 16px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  transition-duration: 0.4s;
  cursor: pointer;
}

.button1 {
  background-color: white;
  color: black;
  border: 2px solid #4CAF50;
}

.button1:hover {
  background-color: #4CAF50;
  color: white;
}

.button2 {
  background-color: white;
  color: black;
  border: 2px solid #008CBA;
}

.button2:hover {
  background-color: #008CBA;
  color: white;
}

</style>
</head>
<body>

<button class="button button1">Green</button>
<button class="button button2">Blue</button>

</body>
</html>

संबंधित पृष्ठ

HTML DOM संदर्भ: बटन ऑब्जेक्ट

सीएसएस ट्यूटोरियल: स्टाइलिंग बटन


डिफ़ॉल्ट सीएसएस सेटिंग्स

कोई नहीं।