Saturday, May 31, 2025
Latest:
  • German articles for the nominative, accusative, and dative cases
  • Der kleine Vogel und die Sonne
  • German alphabet pronunciation
  • Command design pattern
  • German words with gender
Upokary

Upokary

Quality information

  • Health
  • Life
  • Fashion
  • Food
  • Code
  • English
  • বাংলা
Technology 

How to horizontally center an element using CSS?

Published: January 25, 2021Last updated: July 23, 2021css

In this post, we will discuss the different approaches to make an element centered using CSS. Let’s consider we have the following parent and child elements.

<div class="parent">
    <div class="child">Content</div>
</div>

Following is the style to make it horizontally centered.

<style>
    .parent{
        display: flex;
        justify-content: center;
    }
</style>
Reference:
  • Horizontally center an element

You May Also Like

How to do querySelector with wildcard match?

June 8, 2022 beroza

Traverse array of objects recursively in JavaScript

February 13, 2022 beroza

Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment

August 23, 2019 beroza

Write a Program to Merge Two Sorted Lists

May 21, 2023 beroza

Why prefer interfaces to abstract classes?

March 11, 2020 beroza
apple macbook

Things we should do before buying a Apple MacBook

February 21, 2021 beroza

What is pseudo element ::before and ::after in CSS?

May 9, 2019 beroza

What are new in Java 14 or new features of Java 14

August 4, 2020 beroza

TypeError: Cannot assign to read only property of object ‘#Object’ reactjs

April 15, 2019 beroza

Why Upokary?

Upokary.com is a useful application in everyday life. It provides very handy information regarding every aspect of life. Each and every tip of upokary.com is meant to make life better.

Upokary tools

  • Youtube thumbnail
  • Youtube video downloader

Useful Links

  • Handy code
  • Technology
  • People
  • Programming
  • Quote
  • Travel
  • WordPress
  • IELTS
  • Kids

Languages

  • EnglishEnglish
  • বাংলাবাংলা

Pages

  • Sitemap
  • Privacy policy
  • About us
  • Contact us

Support

For any kind of query or question please drop a message in the following email: upokary@gmail.com
Copyright © 2025 Upokary. All rights reserved.