News for hackers. Stuff that matters.
Re:How to Center in CSS (2015) by diablo1 on Tuesday May 19, 2020 @01:41PM (#23237748)

    <div class=element></div>
    
    <style>
    .element{
    position:absolute;
    width:500px;
    height:500px;
    left:50%;
    top:50%;
    margin-top:-250px;
    margin-left:-250px;
    }
    </style>
Re:How to Center in CSS (2015) by viklove on Tuesday May 19, 2020 @01:43PM (#23237784)
Don't do this, you will run into edgecases that make things look jank. Use flexbox: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
Re:How to Center in CSS (2015) by diablo1 on Tuesday May 19, 2020 @01:45PM (#23237804)
Thanks for the tip. Any particular browser that causes such 'jank'?
Re:How to Center in CSS (2015) by Chyzwar on Tuesday May 19, 2020 @05:23PM (#23240415)
This would center a fixed sized element in absolute position to page, this was never an issue. Problems start when you do not know size of your element and its parent. Flex finally fixes[1] this issue but it was not fully supported until recently[2].

[1] https://philipwalton.github.io/solved-by-flexbox/demos/verti... [2] https://github.com/philipwalton/flexbugs

Most of the flexbugs are now fixed and flex should be recommended way of making layouts.

Re:How to Center in CSS (2015) by colejohnson66 on Tuesday May 19, 2020 @02:46PM (#23238540)
This requires advanced knowledge of the width and height of the `.element`