gpt4 book ai didi

html - Css 左过渡不适用于高度和左

转载 作者:行者123 更新时间:2023-11-28 02:07:56 25 4
gpt4 key购买 nike

我正在尝试制作某种工具箱,我需要让工具箱在打开时从左侧出现,所以我从left=-1500px 过渡到left=0; 效果很好。

当我尝试对 height=0;width=0; 添加过渡进行某种最小化时,我添加了:transition: width, height 1s linear; transition left停止工作。

这里是例子:https://jsfiddle.net/wsghc65c/7/

我的CSS:

.modal {
visibility: visible;
position: fixed;
z-index: 1;
left: 10%;
top: 10%;
width: 80%;
height: 80%;
margin: auto;
opacity: 1;
padding: 10px;
padding-top: 25px;
border-radius: 15px;
background-color: #aaa;
border-width: thin;
border-style: solid;
transition: visibility 0.1s linear;
transition: left 1s linear;
transition: width, height 1s linear;
}

.modal-content {
overflow: -moz-scrollbars-vertical;
overflow-x: hidden;
overflow-y: scroll;
max-height: 80vh;
mac-width: 86vh;
}

.modal-left-hide {
visibility: hidden;
left: -1500px;
}

.modal.minimized {
width: 0%;
height: 0%;
left: 10vh;
padding: 0;
margin: 0;
}

最佳答案

https://jsfiddle.net/wsghc65c/16/

将高度宽度过渡添加到最小化类。您可能还想将溢出设置为隐藏。

.modal.minimized {
width: 0%;
height: 0%;
left: 10vh;
padding: 0;
margin: 0;
transition: width 1s linear, height 1s linear;
}

关于html - Css 左过渡不适用于高度和左,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48927836/

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