Css转换无法正常工作

时间:2014-03-22 16:47:31

标签: javascript jquery html css typography

所以我试图进行这种排版转换。我的信都是白色的。当我将鼠标悬停在顶部时,字母的上半部分应向下翻转,露出不同的颜色。问题在于它正在翻错div

tback是字母A的下半部分。 tfront是字母A的上半部分。

HTML code:

<div id="letter-container" class="letter-container">
    <h2><a href="#"> 
    <div class="twrap">

        <div class="tup">
            <div class="tback"><span>A</span></div>
            <div class="tfront"><span>A</span></div>

        </div>
        <div class="tbg"><span>A</span></div>
        <div class="tdown"><span>A</span></div>
    </div></a></h2>
</div>

这是CSS:

.letter-container h2 .twrap{
    position: relative;
    display: inline-block;
    width: 100px;
    height: 120px;
    line-height: 120px;
    font-size: 120px;


    box-shadow: 1px 1px 4px #000;
}
.letter-container h2 .tbg{
    background: #121212;
    position: absolute;
    color: #f2c200;
    width: 100%;
    height: 100%;
    z-index: -10;
    box-shadow: 0px 1px 3px rgba(0,0,0,0.9);
}
.letter-container h2 .tdown{
    height: 50%;
    top: 50%;
    width: 100%;
    position: absolute;
    overflow: hidden;
    z-index: 1;
    background: #151515;
    color: white;

    box-shadow: 0px 1px 3px rgba(0,0,0,0.9);
    transition: all 0.3s linear;
}
.letter-container h2 .tdown span,
.letter-container h2 .tup .tback span{
   display: block;
   margin-top:-60px;

}
.letter-container h2 .tup{
    height: 50%;
    width: 100%;
    position: absolute;
    z-index: 10;
    -webkit-transform-origin: 50% 100%;
    transition: all 0.3s linear;
    color: white;
    box-shadow: 0px 1px 3px rgba(0,0,0,0.9);
}

.letter-container h2 .tup .tfront{
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0px;
    overflow: hidden;

    background: #151515;


  }

/*Drop down part*/
.letter-container h2 .tup .tback{
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0px;
    overflow: hidden;

    background: #151515;

    color: #f2c200;

  }
.letter-container h2 .tup .tdown{
    background: red;
    color: red;

 }
.letter-container h2 .tup .tback{
    -webkit-transform: rotateX(180deg); 
}
.letter-container h2 a .twrap:hover .tup {

    -webkit-transform: rotateX(180deg);

}

这是一个显示问题的JSFiddle:

http://jsfiddle.net/g4zja/

1 个答案:

答案 0 :(得分:1)

不确定所需的效果究竟是什么。也许这个?

fiddle

.letter-container h2 a .twrap:hover .tup {
  -webkit-transform: rotateX(90deg);
}