Posted under Angular & CSS & PrimeNG & Web
Permalink
Tags Gotcha, Tip
I posted about this kind of issue back in 2010 here.
Nowadays for my own project work I am happy to assume recent browsers, in particularly IE11 at least (noting that even this has been out a while now – it was released 4 years ago now so a reasonable start point).
This means that I am happy to use css Flex which makes this insanely simple compared to the old days. You just need display:flex;align-items:center in the container div and its content items will centre vertically.
I’ve just used this on a PrimeNG data list component to centre left thumbnails correctly in a list item with no issues.
Quite why we have had to suffer for so many years with arcane tricks (or risk ridicule by making it simple using tables for layout) is beyond me, but there we are.
Leave a Reply
You must be logged in to post a comment.