New Answer
Based on what you gave me, this is the required CSS code, using the old faithful position absolute method.
#highlight_lose {
height: 300px;
width: 100%;
position: absolute;
top: 50%;
margin-top: -150px;
}
div.sad_smileyface {
width: 300px;
height: 100%;
position: relative;
margin: 0 auto;
...
[your graphic styling code here]
}
One point to note, is I set the containing div's width to 100% and centered it vertical. I then centered the child smileyface div horizontally. This isn't required, just the method I did it in. If the height changes, adjust the #highlight_lose
, if the width changes, update sad_smileyface
Original Answer
If the height is at least decalred (which yours is), set the parent container as position: relative
(just to make sure), you should be able to use margin: auto;
on your child div's. This should work cross-browser to IE 6.
Other options include doing your method, by setting the margin to negative half the height and width. margin: -275px -275px;
.
Also, CSS3's Flexbox model will fix this as well, but is heavily prefixed and not supported everywhere.