---
title: "Comment by Andrew Savetchuk on \"3 Easy Ways to Center a Div/Element\" | Hashnode"
description: "Good article! It is also possible to center the div using CSS grid like so: body { margin : 0 ; width : 100% ; min-height : 100vh ; display : grid; justify-cont"
url: "https://hashnode.com/posts/3-easy-ways-to-center-a-divelement/63e4ffc4553cad5af67ece59/comment/63e5749fdb59c3f72b9f314f"
---

[Discussion](https://hashnode.com/posts/3-easy-ways-to-center-a-divelement/63e4ffc4553cad5af67ece59)

Comment [3 Easy Ways to Center a Div/Element](https://hashnode.com/posts/3-easy-ways-to-center-a-divelement/63e4ffc4553cad5af67ece59)

[Andrew Savetchuk](https://hashnode.com/@AndrewSavetchuk)

[Feb 9, 2023](https://hashnode.com/posts/3-easy-ways-to-center-a-divelement/63e4ffc4553cad5af67ece59/comment/63e5749fdb59c3f72b9f314f)

Good article! It is also possible to center the div using CSS grid like so:

```
body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  display: grid;
  justify-content: center;
  align-items: center;
}

div {
  background: lightgreen;
  height: auto;
}
```

[Kajal Jaiswal](https://hashnode.com/@kajal1801)

[Feb 10, 2023](https://hashnode.com/posts/3-easy-ways-to-center-a-divelement/63e4ffc4553cad5af67ece59/comment/63e5749fdb59c3f72b9f314f#reply-63e5b218f30581f89abccfcb)

Hey thanks for your input.. I actually didn't add grids because I feel it's a really great topic and I should write another blog specifically for grids. In this blog i only mentioned 3 easy ways to center elements, i know there are many more but these are like easiest tricks.
