0

I tried to vertically align some content into div box. to achieve this I have found some CSS that works perfect. Except for you know who it doen't: IE8. When using the display attribute with the value 'table-cell', IE is creating an invisible cellpadding/cellspacing.

.item_box{
        display: table-cell;
        padding:0px;
        margin:0px;
        width:160px;
        height:160px;
        text-align: center;
        vertical-align:middle;
    }  

the two lines 'padding' and 'margin' do affect only FF, Chrome, Opera. I need it to be '0' padding/spacing to preserve the main layout. Any clue how to solve this for IE?
thanks a lot

  • What's the element you are attempting to center inside this div? – james6848 Mar 31 '11 at 08:52
  • actually "" inside another "
    ". I even tried to set td.classname cellpaddind via CSS. but it didn't work. thanks and sorry for the delay.
    –  Apr 06 '11 at 08:02
  • Seems to work for me in IE8... if you post all the code maybe I can have another look. – james6848 Apr 06 '11 at 11:30

1 Answers1

0

Regarding your "invisible cellpadding/cellspacing", try experimenting with "border-collapse:collapse;" on your surrounding "display:table" container css.

Oskar
  • 1
  • OIC, this was a ghost post. I managed to miss the age of the question when I decided to post. =( – Oskar Nov 25 '11 at 16:22
  • 1
    No problem. It's fine to answer old questions on Stack Overflow, since many people will stumble across the answers later via google. Thanks for posting! – Adrian Macneil Nov 06 '12 at 00:46