Back to campField Journalby Zin
All entries

winechanz

How to Center Elements in CSS 💡

In this post, I'll show you 9 ways to center Elements, each with a little code Snippet.

2 min read0 likes

How to center elements in CSS 💡

ဒီ content မှာကတော့ မိတ်ဆွေတို့ကို Center ကို Elements တွေပို့လို့ရမယ့် Code (၉) မျိုးကို Snippet လေးတွေနဲ့ပြပေးပါ့မယ်။

ဖတ်ချိန် 2 မိနစ်0 likes

Hello guys ✌️

It's been a while since we've had any Web-related Content, hasn't it? Well, I'm back now.

Every now and then, Developers run into one particular headache when writing code: getting Elements centered exactly the way you want. Even at an Advanced Level, you sometimes end up searching for the code just to center something.

In this post, I'll show you 9 ways to center Elements, each with a little code Snippet. These are what I actually use in real time, so you can try them out yourself. If you can't look through them right now, you can Save this for later. I hope something here helps you out.

Flexbox and align-self

Absolute position and translate

Grid and place-items

Grid, justify-content and align-items

Flexbox and an auto margin

Flexbox, align-items and justify-content

Inset 0 and an auto margin

Grid, align-self and justify-self

Grid and place-self

See you again in the next post.

Good Bye Everyone 💗

Hello guys ✌️

ကျွန်တော်တို့ Web နဲ့သက်ဆိုင်တဲ့ Content တွေနဲ့မတွေ့ရတာကြာပြီနော်။ အခုပြန်လာပါပြီ

တစ်ခါတလေမှာ Developer အတွက် codeရေးတဲ့အခါအခက်အခဲတစ်ခုရှိတတ်ပါတယ်။ လိုချင်သလို Elements တွေကို Center ကိုပို့ချင်တဲ့အခါပါ။ Advanced Level မှာတောင်တစ်ခါတလေ center ပို့ဖို့ကို code လိုက်ရှာနေရတာမျိုးတွေရှိပါတယ်

ဒီ content မှာကတော့ မိတ်ဆွေတို့ကို Center ကို Elements တွေပို့လို့ရမယ့် Code (၉) မျိုးကို Snippet လေးတွေနဲ့ပြပေးပါ့မယ်။ တကယ့် real time မှာ သုံးနေတာမို့လို့ လိုက်စမ်းလို့လည်းရပါတယ်။ အခုမကြည့်နိုင်သေးရင်လည်း Save ထားလို့ရပါတယ်။ တစ်ခုခုအထောက်အကူရသွားလိမ့်မယ်လို့မျှော်လင့်ပါတယ်

Flexbox and align-self

Absolute position and translate

Grid and place-items

Grid, justify-content and align-items

Flexbox and an auto margin

Flexbox, align-items and justify-content

Inset 0 and an auto margin

Grid, align-self and justify-self

Grid and place-self

နောက်တစ်ပုဒ်နဲ့ပြန်တွေ့ကြတာပေါ့

Good Bye Everyone 💗

Filed underwinechanz

Written byZin Min Htun (Wine Chanz)Senior Full-Stack Developer · Da Nang, VietnamSay hello at campMore entries