要点:

当元素 height 不确定时,可以使用 max-height 设置动画效果
a[href="foldBox"] 用于打开 #foldBox(利用伪元素 :target)
a[href="#"] 用于关闭 #foldBox

<style>
body { padding: 10px; }
.open {
display: inline-block;
font-weight: 800;
font-size: 18px;
text-decoration: none;
border: 1px solid ;
padding: 10px;
margin: 0 0 10px;
border-radius: 10px;
}
.foldBox {
overflow: hidden;
box-sizing: border-box;
width: 100%;
max-height: 0;
text-align: center;
border-radius: 10px;
transition: all .3s;
}
img {width: 30%;}
p {
font-weight: 800;
font-size: 20px;
}
.foldBox:target {
padding: 10% 0; /*该属性只能运用于元素展开后*/
max-height: 800px;
border: 1px solid ;
} </style>
<a class="open" href="#foldBox">What's this?</a>
<div id="foldBox" class="foldBox">
<img src="32.jpg">
<p>Are You Happy?</p>
<a href="#">YES</a>
</div>

最新文章

  1. mysql数据表拷贝
  2. C#拾遗-边边角角
  3. linux 重新编译低版本gcc
  4. Android Instrumention.sendPointerSync发送Event失败分析
  5. Java--concurrent并发包下阻塞队列介绍
  6. SharePoint Online 创建门户网站系列之准备篇
  7. Android虚拟机Classic qemu does not support SMP问题记录
  8. nodejs高大上的部署方式-PM2
  9. Android 签名工具 shell脚本
  10. LeetCode(一)
  11. uva 11922 Permutation Transforme/splay tree
  12. dom4j处理xml文件,读取xml字符串,格式化xml文件
  13. JavaIO(01)File类详解
  14. Google code: Why ‘Everything up-to-date’ when pushing (git)
  15. poj2352Stars
  16. UML--一些图
  17. hdu2089不要62(数位dp)
  18. 【百度地图API】多家地图API内存消耗对比测验(带源码)
  19. win10 Internet Explorer 11 停止工作处理
  20. 执行Sqlserver中waitfor delay延时操作或waitfor time定时操作

热门文章

  1. WebSQL是HTML 5规范的一部分吗?
  2. 用 wait-notify 写一段代码来解决生产者-消费者问题?
  3. 攻防世界 easytornado
  4. (stm32f103学习总结)—printf重定向
  5. css中几个重要概念
  6. HTML5 Canvas绘制效率如何?
  7. 微信小程序自定义tab,多层tab嵌套实现
  8. HCNP Routing&amp;Switching之组播技术-组播路由协议PIM
  9. leetcode1753. 移除石子的最大得分
  10. EMS创建独立新用户并分配邮箱