【问题标题】:css transition height not effecting textCSS过渡高度不影响文本
【发布时间】:2015-12-30 21:38:05
【问题描述】:

我已经对一个框应用了高度过渡,但它只影响边框而不是其中的文本。我想让文字随着方框慢慢缩小,如何实现缓慢过渡隐藏文字?

代码:

<div class="test">
this is my test
</div>

css:

.test {
    transition: height 2s, ease-in;
    height: 400px;
    width: 600px;
    border: 1px solid red;
}

    .test:hover{
        height: 1px;
    }

jsfiddle

【问题讨论】:

    标签: html css


    【解决方案1】:

    添加溢出:隐藏;

    .test {
        transition: height 2s, ease-in;
        height: 400px;
        width: 600px;
        border: 1px solid red;
        overflow: hidden;
    }
    

    【讨论】:

    • 我正要发这个。
    • @Scimonster 简单一:P
    猜你喜欢
    • 1970-01-01
    • 2017-04-23
    • 1970-01-01
    • 1970-01-01
    • 2015-09-16
    • 1970-01-01
    • 1970-01-01
    • 2020-07-14
    • 1970-01-01
    相关资源
    最近更新 更多