ပုံစံ အနေအထား Property
ဥပမာ
<div> ဒြပ်စင်တစ်ခု၏ အနေအထားကို ဆွေမျိုးမှ အကြွင်းမဲ့အဖြစ်သို့ ပြောင်းပါ-
document.getElementById("myDIV").style.position = "absolute";
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
ရာထူးပိုင်ဆိုင်မှုသည် ဒြပ်စင်တစ်ခုအတွက် အသုံးပြုသည့် နေရာချထားမှုနည်းလမ်းအမျိုးအစား (အငြိမ်၊ ဆွေမျိုး၊ အကြွင်းမဲ့ သို့မဟုတ် ပုံသေ) ကို သတ်မှတ်ပေးသည် သို့မဟုတ် ပြန်ပေးသည်။
Browser ပံ့ပိုးမှု
Property | |||||
---|---|---|---|---|---|
position | Yes | Yes | Yes | Yes | Yes |
အထားအသို
ရာထူးပိုင်ဆိုင်မှုကို ပြန်ပေးပါ-
object.style.position
ရာထူးပိုင်ဆိုင်မှုကို သတ်မှတ်ပါ-
object.style.position = "static|absolute|fixed|relative|sticky|initial|inherit"
အိမ်ခြံမြေတန်ဖိုးများ
Value | Description |
---|---|
static | Elements renders in order, as they appear in the document flow. This is default. |
absolute | The element is positioned relative to its first positioned (not static) ancestor element |
fixed | The element is positioned relative to the browser window |
relative | The element is positioned relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position |
sticky | The element is positioned based on the user's scroll position
A sticky element toggles between |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
နည်းပညာဆိုင်ရာအသေးစိတ်
မူလတန်ဖိုး: | အငြိမ် |
---|---|
ပြန်ပို့တန်ဖိုး- | ဒြပ်စင်တစ်ခု၏ အနေအထားအမျိုးအစားကို ကိုယ်စားပြုသော စာကြောင်းတစ်ခု |
CSS ဗားရှင်း | CSS2 |
နောက်ထပ် ဥပမာများ
ဥပမာ
မတူညီသော အနေအထားအမျိုးအစားများကို အသုံးပြုခြင်း-
function myFunction(x) {
var whichSelected = x.selectedIndex;
var posVal = x.options[whichSelected].text;
var elem = document.getElementById("myDiv");
elem.style.position = posVal;
}
ဥပမာ
<h2> ဒြပ်စင်၏ အနေအထားကို ပြန်ပေးပါ။
alert(document.getElementById("myH2").style.position);
ဆက်စပ်စာမျက်နှာများ
CSS သင်ခန်းစာ- CSS နေရာချထား ခြင်း။
CSS ရည်ညွှန်းချက်- ရာထူးပိုင်ဆိုင်မှု
❮ စတိုင်အရာဝတ္ထု