CSS နောက်ခံ-တည်နေရာ ပိုင်ဆိုင်မှု
ဥပမာ
နောက်ခံပုံတစ်ပုံကို ဘယ်လိုနေရာချရမလဲ။
body
{
background-image: url('w3css.gif');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
အောက်တွင် နောက်ထပ် "စမ်းသုံးကြည့်ပါ" ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
background-position
ပိုင်ဆိုင်မှုသည် နောက်ခံပုံတစ်ခု၏ စတင်သည့် အနေအထားကို သတ်မှတ်ပေးသည် ။
အကြံပြုချက်- ပုံမှန်အားဖြင့်၊ နောက်ခံပုံတစ်ပုံ ကို ဒြပ်စင်တစ်ခု၏ ဘယ်ဘက်အပေါ်ထောင့်တွင် ထားရှိကာ ဒေါင်လိုက်နှင့် အလျားလိုက် နှစ်ခုစလုံးကို ထပ်ခါတလဲလဲ ပြုလုပ်ထားသည်။
မူလတန်ဖိုး: | ၀% ၀% |
---|---|
အမွေဆက်ခံသည်- | မဟုတ်ဘူး |
သက်ဝင်လှုပ်ရှားနိုင်သော | ဟုတ်တယ် ကာတွန်း အကြောင်းဖတ်ပါ။ |
ဗားရှင်း- | CSS1 |
JavaScript syntax- | အရာဝတ္ထု .style.backgroundPosition="center" |
Browser ပံ့ပိုးမှု
ဇယားရှိ နံပါတ်များသည် ပိုင်ဆိုင်မှုကို အပြည့်အဝထောက်ခံသည့် ပထမဆုံးဘရောက်ဆာဗားရှင်းကို သတ်မှတ်ပေးသည်။
Property | |||||
---|---|---|---|---|---|
background-position | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
မှတ်ချက်- IE8 နှင့် အစောပိုင်းတွင် ဒြပ်စင်တစ်ခုရှိ နောက်ခံပုံအများအပြားကို မပံ့ပိုးပါ။
CSS Syntax
background-position: value;
အိမ်ခြံမြေတန်ဖိုးများ
Value | Description | Play it |
---|---|---|
left top left center left bottom right top right center right bottom center top center center center bottom |
If you only specify one keyword, the other value will be "center" | |
x% y% | The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%. Default value is: 0% 0% | |
xpos ypos | The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%. You can mix % and positions | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
နောက်ထပ် ဥပမာများ
ဥပမာ
နောက်ခံ-ပုံတစ်ပုံကို အပေါ်ဘက်တွင် ဗဟိုပြုရန် မည်ကဲ့သို့ နေရာချရမည်နည်း။
body
{
background-image: url('w3css.gif');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center top;
}
ဥပမာ
နောက်ခံပုံတစ်ပုံကို အောက်ခြေညာဘက်တွင် မည်ကဲ့သို့ နေရာချရမည်နည်း။
body
{
background-image: url('w3css.gif');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: bottom right;
}
ဥပမာ
ရာခိုင်နှုန်းကို အသုံးပြု၍ နောက်ခံပုံတစ်ပုံကို ဘယ်လိုနေရာချရမည်နည်း။
body
{
background-image: url('w3css.gif');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: 50% 50%;
}
ဥပမာ
pixels ကိုအသုံးပြုပြီး နောက်ခံပုံတစ်ပုံကို ဘယ်လိုနေရာချရမလဲ။
body
{
background-image: url('w3css.gif');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: 50px 150px;
}
ဥပမာ
"သူရဲကောင်း" ရုပ်ပုံဖန်တီးရန် မတူညီသော နောက်ခံဂုဏ်သတ္တိများကို အသုံးပြုပါ-
.hero-image {
background-image: url("photographer.jpg"); /* The
image used */
background-color: #cccccc; /* Used if the image is
unavailable */
height: 500px; /* You must set a specified height */
background-position: center; /* Center the image */
background-repeat: no-repeat; /* Do not repeat the image */
background-size: cover; /* Resize the background image to cover the entire container */
}
ဆက်စပ်စာမျက်နှာများ
CSS သင်ခန်းစာ- CSS နောက်ခံ
CSS ရည်ညွှန်းချက်- နောက်ခံပုံ ပိုင်ဆိုင်မှု
HTML DOM ရည်ညွှန်းချက်- နောက်ခံအနေအထား ပိုင်ဆိုင်မှု