---
title: "Discussion on \"How To Center A Div Using CSS\" | Hashnode"
description: "Discussion on \"How To Center A Div Using CSS\". In this article, we would be using the block of code below as a case study.\n<div class=\"parent\"><div class=\"child\"></div></div>\n\nThere are 4 major ways to centre a div using CSS and they are:\nUsing Flexbox :\n.parent {    \ndisplay: flex;\n    justify-c..."
url: "https://hashnode.com/posts/how-to-center-a-div-using-css/6424227c6f9045c3b57ab735"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How To Center A Div Using CSS](https://xcelaig.hashnode.dev/how-to-center-a-div-using-css?utm_source=hashnode&utm_medium=feed)

In this article, we would be using the block of code below as a case study. <div class="parent"><div class="child"></div></div> There are 4 major ways to centre a div using CSS and they are: Using Flexbox : .parent { display: flex; justify-c...

Mar 29, 2023 · 1 min read · xcelaig.hashnode.dev  
Read the article

-   [#css](https://hashnode.com/tag/css)
-   [#css3](https://hashnode.com/tag/css3)
-   [#html](https://hashnode.com/tag/html)
-   [#center-a-div](https://hashnode.com/tag/center-a-div)

## Written by

[Excel Aigbosuria](https://hashnode.com/@XcelAig)

@XcelAig

  
[View profile](https://hashnode.com/@XcelAig)

I’m a front end developer, a pharmacist and a writer🤍

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
