---
title: "Discussion on \"How top and translate work together to centre a div\" | Hashnode"
description: "Discussion on \"How top and translate work together to centre a div\". I've known for a long time that centring an absolutely positioned div requires writing:\ntop: 50%;\nleft: 50%;\ntranslate(-50%, -50%);\n\nbut until this week I never considered how it works. I found out by accident and it's so obvious once you know. It's ..."
url: "https://hashnode.com/posts/how-top-and-translate-work-together-to-centre-a-div/6252d7f992d73e7055c19a17"
---

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

Discussion

# [How top and translate work together to centre a div](https://blog.nicm42.me.uk/how-top-and-translate-work-together-to-centre-a-div?utm_source=hashnode&utm_medium=feed)

I've known for a long time that centring an absolutely positioned div requires writing: top: 50%; left: 50%; translate(-50%, -50%); but until this week I never considered how it works. I found out by accident and it's so obvious once you know. It's ...

Apr 10, 2022 · 3 min read · blog.nicm42.me.uk  
Read the article

-   [#css](https://hashnode.com/tag/css)

## Written by

[Nic](https://hashnode.com/@nicm42)

@nicm42 · England

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

This week I learnt...

Front End Developer. I like problem solving and making things pretty. I also like red.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
