简体   繁体   中英

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);

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM