Work around to make table-cell CSS render properly in IE6/7?

半世苍凉 提交于 2019-12-11 10:35:40

问题


My site is showing up fine in IE8/Firefox/Chrome but I can't figure out how to make it function with IE.

The relevant CSS:

#maincontent {  
  display: table;   
}  

#content {  
  display: table-cell;  
  width: 620px;
  padding-left:4%;
  padding-right: 22px; 
  padding-bottom:15px;  
} 

#sidebar { 
  display: table-cell;  
  width: 300px; 
} 

#content and #sidebar are in #maincontent. On IE6/7 #sidebar will be under #content. I've tried setting the sidebar to display:block with a float, and it will then render fine in IE6/7 but all the other browsers get screwed up. How can I get this setup?


回答1:


From W3Schools:

No versions of Internet Explorer (including IE8) support the property values "inline-table", "run-in", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-row", or "table-row-group".

The best solution is probably to build a real table.




回答2:


CSS tables aren't supported in IE, so you'll probably want to try working with just floats and margins. I'd recommend taking a look at the positioning on one of these templates and working from there.



来源:https://stackoverflow.com/questions/3327046/work-around-to-make-table-cell-css-render-properly-in-ie6-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!