- Dropup လုပ်နည်း
CSS ဖြင့် dropup menu တစ်ခုဖန်တီးနည်းကို လေ့လာပါ။
Dropup
Dropup Menu သည် အသုံးပြုသူအား ကြိုတင်သတ်မှတ်ထားသောစာရင်းမှ တန်ဖိုးတစ်ခုကို ရွေးချယ်နိုင်စေမည့် ခလုတ်ဖွင့်နိုင်သော မီနူးတစ်ခုဖြစ်သည်-
Hoverable Dropup တစ်ခုကို ဖန်တီးပါ။
အသုံးပြုသူက မောက်စ်ကို ဒြပ်စင်တစ်ခုပေါ်မှ ရွှေ့သည့်အခါ ပေါ်လာသည့် dropup menu တစ်ခုကို ဖန်တီးပါ။
အဆင့် 1) HTML ကိုထည့်ပါ
ဥပမာ
<div class="dropup">
<button class="dropbtn">Dropup</button>
<div class="dropup-content">
<a href="#">Link
1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
နမူနာရှင်းပြထားပါတယ်။
အစက်ချမီနူးကိုဖွင့်ရန် မည်သည့်ဒြပ်စင်ကိုသုံးပါ ဥပမာ <button>၊ <a> သို့မဟုတ် <p> ဒြပ်စင်။
dropup menu ကိုဖန်တီးပြီး ၎င်းအတွင်းတွင် dropup links များကိုထည့်ရန် container element ( <div> ကဲ့သို့) ကိုသုံးပါ။
Dropup Menu ကို CSS ဖြင့် မှန်ကန်စွာ နေရာချရန် ခလုတ်နှင့် <div> အနီးတစ်ဝိုက်တွင် <div> ဒြပ်စင်တစ်ခုကို ခြုံပါ။
အဆင့် 2) CSS ကိုထည့်ပါ
ဥပမာ
/* Dropup Button */
.dropbtn {
background-color: #3498DB;
color: white;
padding: 16px;
font-size: 16px;
border: none;
}
/* The
container <div> - needed to position the dropup content */
.dropup {
position: relative;
display:
inline-block;
}
/* Dropup content (Hidden by Default) */
.dropup-content {
display: none;
position:
absolute;
bottom: 50px;
background-color: #f1f1f1;
min-width: 160px;
box-shadow:
0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
/* Links inside the
dropup */
.dropup-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropup links on hover */
.dropup-content a:hover {background-color: #ddd}
/* Show the
dropup menu on hover */
.dropup:hover .dropup-content {
display: block;
}
/* Change the background color of the dropup button when the
dropup content is shown */
.dropup:hover .dropbtn {
background-color: #2980B9;
}
နမူနာရှင်းပြထားပါတယ်။
ကျွန်ုပ်တို့သည် dropup ခလုတ်ကို နောက်ခံအရောင်၊ padding စသည်ဖြင့် ပုံဖော်ထားပါသည်။
dropup အကြောင်းအရာကို dropup ခလုတ် ၏ ထိပ်တွင် (အသုံးပြု၍ ) ထားရှိစေလိုသောအခါတွင် .dropup
အတန်းသည် အသုံးပြုသည် ။position:relative
position:absolute
.dropup-content
အတန်းသည် အမှန်တကယ် dropup menu ကို ကိုင်ဆောင်ထားသည် ။ ၎င်းကို ပုံသေအားဖြင့် ဝှက်ထားပြီး၊ ပျစ်ပေါ်တွင် ပေါ်နေမည် (အောက်တွင် ကြည့်ပါ)။ min-width
160px ဟု သတ်မှတ်ထားသည်ကို သတိပြုပါ ။ ဒါကို ပြောင်းလဲဖို့ အားမနာပါနဲ့။ အကြံပြုချက်- dropup အကြောင်းအရာ၏ အကျယ်ကို dropup ခလုတ်ကဲ့သို့ ကျယ်စေချင်ပါက၊ width
100% (နှင့် overflow:auto
သေးငယ်သော ဖန်သားပြင်များပေါ်တွင် scroll ကိုဖွင့်ရန်)။
ဘောင် ကိုအသုံးပြုမည့်အစား၊ box-shadow
dropup menu ကို "ကတ်" နှင့်တူအောင်ပြုလုပ်ရန် ပိုင်ဆိုင်မှုကို အသုံးပြုထားသည်။ အခြားဒြပ်စင်များရှေ့တွင် dropup ကို နေရာချရန် z-index ကိုလည်း အသုံးပြုပါသည်။
:hover
အသုံးပြုသူသည် dropup ခလုတ်ပေါ်မှ mouse ကိုရွှေ့သောအခါ dropup menu ကိုပြသရန်ရွေးချယ်သည့်ကိရိယာကိုအသုံးပြုသည် ။