CSS အနေအထား Property
ဥပမာ
<h2> ဒြပ်စင်တစ်ခုကို နေရာချပါ-
h2
{
position: absolute;
left: 100px;
top: 150px;
}
အောက်တွင် နောက်ထပ် "စမ်းသုံးကြည့်ပါ" ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
ပိုင်ဆိုင်မှု သည် position
ဒြပ်စင်တစ်ခုအတွက် အသုံးပြုသည့် နေရာချထားမှုနည်းလမ်းအမျိုးအစား (အငြိမ်၊ ဆွေမျိုး၊ အကြွင်းမဲ့၊ ပုံသေ သို့မဟုတ် ကပ်စေး) ကို သတ်မှတ်သည်။
မူလတန်ဖိုး: | အငြိမ် |
---|---|
အမွေဆက်ခံသည်- | မဟုတ်ဘူး |
သက်ဝင်လှုပ်ရှားနိုင်သော | မဟုတ်ဘူး ကာတွန်း အကြောင်းဖတ်ပါ။ |
ဗားရှင်း- | CSS2 |
JavaScript syntax- | အရာဝတ္ထု .style.position="absolute" |
Browser ပံ့ပိုးမှု
ဇယားရှိ နံပါတ်များသည် ပိုင်ဆိုင်မှုကို အပြည့်အဝထောက်ခံသည့် ပထမဆုံးဘရောက်ဆာဗားရှင်းကို သတ်မှတ်ပေးသည်။
Property | |||||
---|---|---|---|---|---|
position | 1.0 | 7.0 | 1.0 | 1.0 | 4.0 |
မှတ်ချက်- တန်ဖိုးကို sticky
Internet Explorer သို့မဟုတ် Edge 15 နှင့် အစောပိုင်းဗားရှင်းများတွင် ပံ့ပိုးမထားပါ။
CSS Syntax
position: static|absolute|fixed|relative|sticky|initial|inherit;
အိမ်ခြံမြေတန်ဖိုးများ
Value | Description | Play it |
---|---|---|
static | Default value. Elements render in order, as they appear in the document flow | |
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:20px" 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 |
နောက်ထပ် ဥပမာများ
ဥပမာ
ဒြပ်စင်တစ်ခုအား ၎င်း၏ပုံမှန်အနေအထားနှင့် နှိုင်းယှဉ်ရန် မည်ကဲ့သို့ နေရာချရမည်-
h2.pos_left {
position: relative;
left: -20px;
}
h2.pos_right {
position: relative;
left: 20px;
}
ဥပမာ
နောက်ထပ် နေရာချထားခြင်း-
#parent1 {
position: static;
border: 1px solid blue;
width: 300px;
height: 100px;
}
#child1 {
position:
absolute;
border: 1px solid red;
top: 70px;
right: 15px;
}
#parent2 {
position: relative;
border: 1px solid blue;
width: 300px;
height: 100px;
}
#child2 {
position: absolute;
border: 1px solid red;
top: 70px;
right: 15px;
}
ဆက်စပ်စာမျက်နှာများ
CSS သင်ခန်းစာ- CSS နေရာချထား ခြင်း။
HTML DOM ရည်ညွှန်းချက်- ရာထူးပိုင်ဆိုင်မှု