Safari 5.1 breaks CSS table cell spacing

余生颓废 提交于 2019-12-04 08:20:18

For those having trouble with Safari and dimensions for elements set to display:table; I was able to fix my problems by removing the padding and adding padding to a child element set to display:table-cell;

Apparently Safari does not like it when you try to add padding to an element set to display:table; In retrospect, this makes sense.

Solved by making the list elements display as block and float them to the left.

#navigation ul.links li, /* A simple method to get navigation links to appear in one line. */
#navigation .content li {
  display: block;
  float: left;
  padding-right: 0;
  padding-left: 0;
  margin: 0;

  /* below is a fix for IE7 to get the main navigation items lined up correctly
   * in one row
   */
  zoom: 1;
  *display: inline;
}

You want border-collapse:collapse on the display:table element to remove cell spacing.

I took your css and html, and added to the css

body {
    background-color: gray;
}

and I got the following, which looks correct.

This was run under lion, which has Safari 5.1

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