HTML <button> Tag
ဥပမာ
နှိပ်နိုင်သောခလုတ်ကို အောက်ပါအတိုင်း မှတ်သားထားသည်။
<button type="button">Click Me!</button>
အောက်တွင် နောက်ထပ် "စမ်းသုံးကြည့်ပါ" ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
tag သည် <button>
နှိပ်နိုင်သော ခလုတ်ကို သတ်မှတ်သည်။
ဒြပ်စင် တစ်ခုအတွင်းတွင် <button>
သင်သည် စာသား (နှင့် <i>
, <b>
,
<strong>
, <br>
, <img>
, စသည်ဖြင့်) စာသားများကို ထည့်သွင်းနိုင်သည်။ <input>
ဒြပ်စင် ဖြင့် ဖန်တီးထားသော ခလုတ်တစ်ခုဖြင့် ၎င်းသည် မဖြစ်နိုင်ပါ ။
အကြံပြုချက်-type
ဒြပ်စင် တစ်ခုအတွက် အရည်အချင်းကို အမြဲတမ်းသတ်မှတ်ပါ <button>
၊ ၎င်းသည် မည်သည့်ခလုတ်အမျိုးအစားဖြစ်သည်ကို ဘရောက်ဆာများကို ပြောပြရန်။
အကြံပြုချက်- CSS ဖြင့် ခလုတ်များကို လွယ်ကူစွာ ပုံစံသွင်းနိုင်သည်။ အောက်ပါနမူနာများကိုကြည့်ပါ သို့မဟုတ် ကျွန်ုပ်တို့၏ CSS Buttons သင်ခန်းစာကို ဝင်ရောက်ကြည့်ရှုပါ။
Browser ပံ့ပိုးမှု
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>
tag သည် HTML တွင် Global Attributes ကို ပံ့ပိုး ပေးပါသည်။
ဖြစ်ရပ်ဂုဏ်တော်များ
<button>
tag သည် HTML ရှိ Event Attributes များကိုလည်း ပံ့ပိုး ပေးပါသည် ။
နောက်ထပ် ဥပမာများ
ဥပမာ
ခလုတ်များကို ပုံစံဖော်ရန် 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 ရည်ညွှန်း- Button Object
CSS ကျူတိုရီရယ်- Styling Buttons
မူရင်း CSS ဆက်တင်များ
တစ်ခုမှ