gpt4 book ai didi

html - css 过渡高度不影响文本

转载 作者:搜寻专家 更新时间:2023-10-31 22:41:26 26 4
gpt4 key购买 nike

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

代码:

<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

最佳答案

添加溢出:隐藏;

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

关于html - css 过渡高度不影响文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34537634/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com