我的代碼是很簡單但我沒有得到如何過渡工作以及如何它不會在我的HTML就在這裏工作:身高不能轉換工作CSS
<div id="footer">
<div id="footer1">
<p> This should be a footer </p>
</div>
</div>
和我的CSS
#footer {
position: fixed;
bottom: 0;
background-color: black;
min-width: 100%;
font-family: Agency FB;
transition: width 3s;
}
#footer1 {
text-align: center;
color: #4e4e4e;
}
#footer:hover {
opacity: .8;
color: white;
height: 100px;
}
我沒有看到我的代碼有什麼問題。那還是我還沒有經驗。謝謝!
'#footer'元素需要一個固定的數字高度來開始動畫,它不會從'auto'過渡到'100px'。 – mch
試試這個:https://jsfiddle.net/maky/bgeLbpd9/ – fernando
這裏有一些很好的學習資源[mdn](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions )和[css-tricks](https://css-tricks.com/almanac/properties/t/transition/) – Dhaval