ပုံစံ Property ကိုပြသခြင်း ။
ဥပမာ
<div> ဒြပ်စင်ကို မပြသရန် သတ်မှတ်ပါ-
document.getElementById("myDIV").style.display = "none";
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
ပြသမှုပိုင်ဆိုင်မှုသည် ဒြပ်စင်၏ပြသမှုအမျိုးအစားကို သတ်မှတ်ပေးသည် သို့မဟုတ် ပြန်ပေးသည်။
HTML ရှိဒြပ်စင်များသည် အများအားဖြင့် "inline" သို့မဟုတ် "block" ဒြပ်စင်များဖြစ်သည်- inline ဒြပ်စင်တစ်ခုတွင် ၎င်း၏ ဘယ်ဘက်နှင့် ညာဘက်ခြမ်းတွင် လွင့်နေသော အကြောင်းအရာများ ရှိသည်။ ဘလောက်ဒြပ်စင်တစ်ခုသည် စာကြောင်းတစ်ခုလုံးကို ပြည့်စေပြီး ၎င်း၏ဘယ်ဘက် သို့မဟုတ် ညာဘက်တွင် မည်သည့်အရာကိုမျှ မပြသနိုင်ပါ။
ဖော်ပြမှုဆိုင်ရာ ပိုင်ဆိုင်မှုသည် စာရေးသူအား အစိတ်အပိုင်းတစ်ခုကို ပြသရန် သို့မဟုတ် ဝှက်ထားရန်လည်း ခွင့်ပြုထားသည်။ ၎င်းသည် မြင်နိုင်စွမ်း ပိုင်ဆိုင်မှုနှင့် ဆင်တူသည်။ သို့သော် သင်သတ်မှတ်ပါက display:none
၊ ၎င်းသည် ဒြပ်စင်တစ်ခုလုံးကို ဖုံးကွယ်ထားမည်ဖြစ်ပြီး၊ ဒြပ်စင် visibility:hidden
၏အကြောင်းအရာများကို မမြင်နိုင်ဟု ဆိုလိုသော်လည်း ဒြပ်စင်သည် ၎င်း၏မူလအနေအထားနှင့် အရွယ်အစားတွင် ရှိနေမည်ဖြစ်သည်။
အကြံပြုချက်- ဒြပ်စင်တစ်ခုသည် ဘလောက်ဒြပ်စင်ဖြစ်ပါက၊ ၎င်း၏ပြသမှုအမျိုးအစားကို မျှောတ်ပိုင်ဆိုင်မှုဖြင့် ပြောင်းလဲနိုင်သည်။
Browser ပံ့ပိုးမှု
Property | |||||
---|---|---|---|---|---|
display | Yes | Yes | Yes | Yes | Yes |
အထားအသို
ပြသမှု ပိုင်ဆိုင်မှုကို ပြန်ပေးပါ-
object.style.display
ပြသမှုပိုင်ဆိုင်မှုကို သတ်မှတ်ပါ-
object.style.display = value
အိမ်ခြံမြေတန်ဖိုးများ
Value | Description |
---|---|
block | Element is rendered as a block-level element |
compact | Element is rendered as a block-level or inline element. Depends on context |
flex | Element is rendered as a block-level flex box. New in CSS3 |
inline | Element is rendered as an inline element. This is default |
inline-block | Element is rendered as a block box inside an inline box |
inline-flex | Element is rendered as a inline-level flex box. New in CSS3 |
inline-table | Element is rendered as an inline table (like <table>), with no line break before or after the table |
list-item | Element is rendered as a list |
marker | This value sets content before or after a box to be a marker (used with :before and :after pseudo-elements. Otherwise this value is identical to "inline") |
none | Element will not be displayed |
run-in | Element is rendered as block-level or inline element. Depends on context |
table | Element is rendered as a block table (like <table>), with a line break before and after the table |
table-caption | Element is rendered as a table caption (like <caption>) |
table-cell | Element is rendered as a table cell (like <td> and <th>) |
table-column | Element is rendered as a column of cells (like <col>) |
table-column-group | Element is rendered as a group of one or more columns (like <colgroup>) |
table-footer-group | Element is rendered as a table footer row (like <tfoot>) |
table-header-group | Element is rendered as a table header row (like <thead>) |
table-row | Element is rendered as a table row (like <tr>) |
table-row-group | Element is rendered as a group of one or more rows (like <tbody>) |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
နည်းပညာဆိုင်ရာအသေးစိတ်
မူလတန်ဖိုး: | တန်းဝင်ကာစီသည် |
---|---|
ပြန်ပို့တန်ဖိုး- | ဒြပ်စင်တစ်ခု၏ ပြသမှုအမျိုးအစားကို ကိုယ်စားပြုသော စာကြောင်းတစ်ခု |
CSS ဗားရှင်း | CSS1 |
နောက်ထပ် ဥပမာများ
ဥပမာ
ပြသမှုပိုင်ဆိုင်မှုနှင့် မြင်နိုင်မှုပိုင်ဆိုင်မှုကြား ကွာခြားချက်-
function demoDisplay() {
document.getElementById("myP1").style.display = "none";
}
function demoVisibility() {
document.getElementById("myP2").style.visibility = "hidden";
}
ဥပမာ
ဝှက်ထားသော နှင့် ဒြပ်စင်တစ်ခုကို ပြသခြင်းကြား ခလုတ်
function myFunction() {
var x = document.getElementById('myDIV');
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}
ဥပမာ
"inline", "block" နှင့် "none" အကြား ကွာခြားချက်-
function myFunction(x) {
var whichSelected = x.selectedIndex;
var sel = x.options[whichSelected].text;
var elem = document.getElementById("mySpan");
elem.style.display = sel;
}
ဥပမာ
<p> ဒြပ်စင်တစ်ခု၏ ပြသမှုအမျိုးအစားကို ပြန်ပေးသည်-
alert(document.getElementById("myP").style.display);
ဆက်စပ်စာမျက်နှာများ
CSS သင်ခန်းစာ- CSS Display နှင့် မြင်နိုင်စွမ်း
CSS ရည်ညွှန်းချက်- ပစ္စည်းဥစ္စာကို ပြသသည် ။
❮ စတိုင်အရာဝတ္ထု