# Centering a div using absolute positioning

**URL:** <https://forum.kirupa.com/t/centering-a-div-using-absolute-positioning/218905>\
**Category:** Uncategorized\
**Created:** [March 12, 2007, 10:58am UTC](https://forum.kirupa.com/t/centering-a-div-using-absolute-positioning/218905 "2007-03-12T10:58:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Binji](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@Binji](https://forum.kirupa.com/u/Binji)\
**Post date:** [March 12, 2007, 10:58am UTC](https://forum.kirupa.com/t/centering-a-div-using-absolute-positioning/218905/1 "2007-03-12T10:58:46Z")

</div>

I know about the trick with auto left&right margins but i dont see how i can use this here:  
i would like to have a linear gradient background which i scaled to 100% width&height. And now the only way to put something on top of it is using absolute positioning as far as i know. And its hard as hell to center something using it. Any ideas?
