Jeny
Jeny

Reputation: 1

Substitution for display='table-cell' in IE 7

document.getElementById(id).style.display ='table-cell'. This gives error message in IE, this is IE bug or any other solutions please give any other solutions.

IE7 doesn't support this property.

this is my coding. Even Firefox and Chrome are accepted. My problem is IE. Please friends give solution...

var cont2 = document.createElement('div');
cont2.style.display = "table-cell";
cont2.style.verticalAlign = "middle";
cont2.style.lineHeight = 100+"%";
cont2.style.padding = 10+"px";
cont2.appendChild(body);

Upvotes: 0

Views: 1887

Answers (2)

Nick Craver
Nick Craver

Reputation: 630627

In short IE7 doesn't support these display values, they post-date IE7.

Without knowing your layout, I don't know exactly the solution you're after, but if you want to support IE7, you can't use display: table-cell;, they are mutually exclusive. Is it possible to change your layout to use another format, or a conditional stylesheet for IE perhaps?

Upvotes: 1

Matti Virkkunen
Matti Virkkunen

Reputation: 65166

If the only browser it's not working in is IE, then yes, it's likely a bug in IE. (At least old versions of) IE have never supported the table display properties properly.

Upvotes: 0

Related Questions