css - css 转换 :translate to align a div in the center ist not working

标签 css internet-explorer compatibility css-transforms

我将以下 css 代码用于 div 容器

/*media all*/
.rent-a-home-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate( 50%, 50% );
    text-align: center;
}

CSS 适用于所有浏览器,但不适用于 Internet Explorer。带有字体的 div 未居中对齐。

在这里你可以看到:https://www.immvestwolf.de/rent-a-home-2

谢谢!

最佳答案

我使用浏览器检查器工具查看了一下,立即发现了问题。显然,Internet Explorer 在您关闭“)”之前留下的空间有问题。因此,正确的语法是:

transform: translate(-50%, -50%);

代替

transform: translate(-50%, -50% );

关于css - css 转换 :translate to align a div in the center ist not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49046739/

相关文章:

html - 将 HTML 页面连接到 Bootstrap (jumbotron)

javascript - 仅具有最高 z-index 的元素的单击处理程序

javascript - 如何通过 IE 使用 JavaScript 导航到 URL?

css - 背景图片在 IE8 上不显示

css - 最大宽度 :-webkit-fit-content ie 8 equivalent?

internet-explorer - 如何在 IE11 中使用 F12 开发人员工具在旧版 Internet Explorer 上测试我的网站

c++ - CUDA 7.0 提示不支持 gcc 4.9

macos - Mac OS X 10.5 App "not supported on this architecture"通过复制修复?

css - 换行时在 DIV 中缩进文本的最佳方法是什么?

css - Sharepoint 2013 将编辑限制为仅文本