At first, when I say centered, I mean both, vertically and horizontally centered.
I have a table with several tiles (divs) like in Windows 8 with background.images.
Every tile has a centered label (also a div) with a description and a semi transparent background.
Now I’d like to add another div between the tile itself and the label. These div should have a semi-transparent background-color as an overlay of the underlying tile-image-div.
But when I add this overlay-div, my label is not centered horizontally anymore, it is placed at the top of the tile. How can I keep it centered?
This is my code on fiddle:
fiddle (please take a look)
(The problem in the fiddle code is this line:
<div class="SemiTransOverlay">
When I delete this div everything is centered correctly.
What do I have to change to keep everything centered and keep div?)
first of all why you are using tables for layout purposes? we are in 21st century, so start using div’s and for accomplishing the semi transparent div to place behind the label and vertically aligned label you need to use
position: absolute;andtop: -50%;, I’ve also modifiedline-heightfordiv.SemiTransLabelGrossand also usedposition: relativeandz-indexpropertiesDemo
CSS