为了修正这个问题,可以借助外边距的负值,负的外边距可以让元素向相反方向定位,通过指定子元素的外边距为子元素宽度一半的负值,就可以让子元素居中了,css代码如下
/* 此处引用上面的公共代码 */
/*...+ calc 是 ie9+, chrome19+, firefox4+ 安卓4.4+, iOS6+
absolute + transform 否 ie9+, chrome4+, firefox3.5+...安卓3+, iOS6+
writing-mode 否 ie6+, chrome4+, firefox3.5+ 安卓2.3+, iOS5.1+
lineheight 否 ie6+, chrome4+, firefox2...+ 安卓2.3+, iOS6+
table 否 ie6+, chrome4+, firefox2+ 安卓2.3+, iOS6+
css-table 否 ie8+, chrome4+, firefox2+...安卓2.3+, iOS6+
flex 否 ie10+, chrome4+, firefox2+ 安卓2.3+, iOS6+
grid 否 ie10+, chrome57+, firefox52+ 安卓