News for hackers. Stuff that matters.
Re:A div that looks different in every browser by rvense on Sunday July 08, 2018 @04:54PM (#17486142)
You should not be centering things in HTML, that's the stylesheet's job.
Re:A div that looks different in every browser by Dylan16807 on Sunday July 08, 2018 @05:34PM (#17486331)
Sure, what's the CSS to make a div be centered vertically?
Re:A div that looks different in every browser by niutech on Sunday July 08, 2018 @06:02PM (#17486478)
display: flex; align-items: center;
Re:A div that looks different in every browser by Dylan16807 on Sunday July 08, 2018 @07:26PM (#17486884)
Doesn't work unless you have an extra container div.
Re:A div that looks different in every browser by gedy on Sunday July 08, 2018 @09:05PM (#17487257)
Sure, because "vertically centered" means relative to what?
Re:A div that looks different in every browser by Dylan16807 on Monday July 09, 2018 @08:27AM (#17489711)
I want the contents of my div to be centered inside my div.

Just like <center> works, but vertically. You don't need <foo><bar>content</bar></foo> for horizontal centering. I consider it a layering violation to have to do that nesting.

Re:A div that looks different in every browser by gedy on Monday July 09, 2018 @11:00AM (#17490659)
Maybe we are misunderstanding each other, but while you don't need an "extra" container, you do need a container with some known height to vertically center the content in: http://jsfiddle.net/c20gq4pz/
Re:A div that looks different in every browser by smallnamespace on Sunday July 08, 2018 @08:38PM (#17487159)
This is true, but every 'modern' DOM that I've seen has loads of extra container divs precisely to allow post hoc layout.
Re:A div that looks different in every browser by Grumbledour on Monday July 09, 2018 @08:49AM (#17489794)
To be fair though, this has been a problem for quite some time and mostly stems from many web devs not understanding block and inline correctly and thus applying unneeded divs everywhere even there are enough hooks for their styles already.
Re:A div that looks different in every browser by jwarren on Monday July 09, 2018 @04:19AM (#17488715)
Or you can use the body: https://codepen.io/jodi/pen/oMvLaN
Re:A div that looks different in every browser by lisper on Sunday July 08, 2018 @05:07PM (#17486203)
I have no objection to having a style sheet that defines what the <center> tag does. But it should at least be possible to have a center tag and a vertical-center tag. AFAICT it is not possible. At the very least you need both a center-capable container and centered elements.
Re:A div that looks different in every browser by rvense on Monday July 09, 2018 @03:02AM (#17488440)
I don't think it should:

You're always centering children with respect to something, and you specify the fact that you want children centered on the thing you're centering them in, rather than the elements themselves. This makes more sense, in my opinion, and as said in the sibling comment, it's two simple rules.

I do a tonne of flexbox and grid in my day-to-day, and these complaints are quite simply out of date. Almost any layout in CSS these days can be done easily and intuitively.

Re:A div that looks different in every browser by crimsonalucard on Monday July 09, 2018 @04:10AM (#17488688)
By out of date do you mean around 1 year old? I'm sorry but your statement will likely be out of date soon.