首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >替换transform: transform()

替换transform: transform()
EN

Stack Overflow用户
提问于 2014-03-04 20:35:19
回答 1查看 736关注 0票数 0

我需要修改我的Css。这是我的CSS

代码语言:javascript
运行
复制
.msg {
    background-color: #fff;
    border: 3px solid #fff;
    display: inline-block;
    left: 50%;
color:#123456;
    opacity: 0;
    padding: 35px;
    position: fixed;
    text-align: justify;
    top: 40%;
    visibility: hidden;
    z-index: 10;

    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}

如何删除下面的部分,并取得相同的结果?

代码语言:javascript
运行
复制
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-04 20:46:10

如果您可以为.msg定义一个特定的高度,这可能是可行的。

代码语言:javascript
运行
复制
.msg {
    background-color: #fff;
    border: 3px solid #fff;
    display: inline-block;
    height:200px; /*If you can define this*/
    width:200px; /*and this*/
    top:calc(40% - 100px); /*then use calc() to subtract half of .msg from top*/
    left:calc(50% - 100px); /*then use calc() to subtract half of .msg from  top*/                   
    color:#123456;
    opacity: 0;
    padding: 35px;
    position: fixed;
    text-align: justify;
    visibility: hidden;
    z-index: 10;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22182448

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档