justify-self
W3C CSS Snapshot 2026
Grid item တစ်ခုတည်းရဲ့ inline axis alignment ကို ပြောင်းပါတယ်။
Code စမ်းလို့ရတဲ့ သင်ခန်းစာ ဖွင့်ရန်
ဒီစာမျက်နှာမှာ
ရေးပုံနဲ့ သုံးလို့ရတဲ့ တန်ဖိုးများ
| တန်ဖိုး သို့မဟုတ် ရေးပုံ | အလုပ်လုပ်ပုံ |
|---|---|
auto | ပုံမှန် grid layout မှာ container ရဲ့ justify-items ကို ယူပါတယ်။ |
normal | အရွယ် auto ဖြစ်တဲ့ grid item အများစုမှာ stretch လို အလုပ်လုပ်ပါတယ်။ သဘာဝအရွယ် ဒါမှမဟုတ် aspect ratio ရှိရင် ပုံမှန် start ဘက်ကို ညှိပါတယ်။ |
stretch | သက်ဆိုင်ရာ axis ပေါ်မှာ item အရွယ်က auto ဆို cell အပြည့် ဆန့်ပါတယ်။ |
start / end / center | Cell ရဲ့ စဘက်၊ ဆုံးဘက် ဒါမှမဟုတ် အလယ်မှာ ညှိပါတယ်။ |
self-start / self-end | Item ရဲ့ စာရေးဦးတည်ချက်ကို ကြည့်ပြီး အစ သို့မဟုတ် အဆုံးဘက်ကို ညှိပါတယ်။ |
baseline / first baseline / last baseline | စာသားရဲ့ ပထမ ဒါမှမဟုတ် နောက်ဆုံး baseline ကို ညှိပါတယ်။ baseline က first baseline နဲ့ တူပါတယ်။ |
safe center / unsafe center | အလယ်ညှိရင် ဘောင်ကျော်မယ့်အခါ safe က start ဘက်ကို ပြောင်းညှိပါတယ်။ unsafe က ရွေးထားတဲ့အတိုင်း ထားပါတယ်။ ဒီ modifier တွေကို ပံ့ပိုးထားတဲ့ နေရာချတန်ဖိုးတွေနဲ့ တွဲသုံးပါ။ |
နမူနာကို စမ်းကြည့်ပါ
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>justify-self example</title>
<style>
.layout { display: grid; width: min(100%, 320px); border: 2px solid teal; box-sizing: border-box; }
.layout > div { padding: 8px 12px; background: #def5f5; color: #123; border: 1px solid #81b9b5; box-sizing: border-box; }
.layout { grid-template-columns: 1fr 1fr; grid-template-rows: 60px 60px; }
.layout .second { justify-self: end; }
</style>
</head>
<body>
<div class="layout">
<div class="first">A</div>
<div class="second">B</div>
<div>C</div>
</div>
</body>
</html>
စမ်းကြည့်ရင် ဘာဖြစ်မလဲ B က သူ့ cell ရဲ့ inline axis အဆုံးနား ကပ်ပါတယ်။ A နဲ့ C က မူလ alignment အတိုင်းပါ။