Kolandoto College - Mwanza Campus
Kolandot College Articles
Articles
Article Image
Advancements in Clinical Training
Article Image
New Drug Developments in 2025
Article Image
AI and Health Research at Kolandot
Article Image
Understanding Tropical Diseases
Article Image
How to Prescribe Antibiotics Correctly
Article Image
The Future of Health Education
Article Image
Emergency Response Training
Article Image
The Role of a Pharmacist
Article Image
Mental Health Awareness in Tanzania
Tadita Group Corporation - Innovating Across Education, Business

taditagroup.com

Kolandot College Blogs
Latest Articles from Kolandot College
Article on Feb 12, 2025
The Future of Clinical Medicine in Tanzania
By Dr. James K.
Article on Feb 10, 2025
Breakthroughs in Pharmacy: New Drug Developments
By Prof. Asha L.
Article on Feb 8, 2025
Improving Health Sciences Education at Kolandot
By Dr. Kennedy O.
Article on Feb 5, 2025
Understanding Antibiotic Resistance in Tanzania
By Dr. Sarah M.
Article on Feb 2, 2025
The Role of AI in Pharmacy and Medicine
By Dr. Alex D.
Article on Jan 28, 2025
How Pharmacists Can Improve Rural Healthcare
By Dr. Peter G.
Article on Jan 25, 2025
The Importance of Clinical Internships
By Dr. Lucy M.
Article on Jan 20, 2025
Common Health Misconceptions in Tanzania
By Dr. Kelvin T.
Article on Jan 15, 2025
Medical Innovations Changing Healthcare
By Dr. Naomi J.
Article on Jan 10, 2025
Essential Skills for Future Medical Professionals
By Dr. Brian N.
CSS Centering Guide

CSS Centering Guide

Centering things in CSS is the poster child of CSS complaining. Why does it have to be so hard?

So let’s make it a decision tree and hopefully make it easier.

I need to center...

Horizontally
Is it inline or inline-* elements (like text or links)?
Use text-align: center; on the parent element.
Is it a block-level element?
Use margin: 0 auto; if it has a set width.
Is there more than one block-level element?
Consider using flexbox or grid for alignment.
Vertically
Is it inline or inline-* elements (like text or links)?
Use line-height equal to container height.
Is it a block-level element?
Use flexbox with align-items: center;.
Both Horizontally & Vertically

You can combine techniques above to get perfectly centered elements.

Is the element of fixed width and height?
Use position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);.
Is the element of unknown width and height?
Use flexbox or grid.
Can you use flexbox?
Set display: flex; justify-content: center; align-items: center;.
Can you use grid?
Use display: grid; place-items: center;.
Conclusion

CSS has many ways to center things, choose what works best for your layout.

Kolandoto College News

Kolandoto College of Health and Allied Sciences

Your Source for News, Events & Articles

Latest News & Updates

Stay informed about the latest events and articles.

Latest Articles

News 1
Advancements in Medical Training

Kolandoto College introduces new simulation labs.

News 2
Health Awareness Campaign

Students take part in community outreach programs.

Quick Hits

  • New semester starts on March 15th
  • Guest lecture on Public Health this Friday
  • Scholarship applications now open

© 2025 Kolandoto College of Health and Allied Sciences

Kolandoto College News

Kolandoto College of Health and Allied Sciences

Your Source for News, Events & Articles

Latest News & Updates

Stay informed about the latest events and articles.

Collections

Classic Tricks

Timeless CSS gems

Scroll Animation

Chris Coyier

Yellow Flash

Chris Coyier

Self-Drawing Shadows

Chris Coyier

Scroll Shadows

Chris Coyier

Editable Style Blocks

Chris Coyier

Scroll Indicator

Chris Coyier

© 2025 Kolandoto College of Health and Allied Sciences