摘要: style.height 获取的是行间的样式 currentStyle.height、getComputedStyle(elem,null).height 获取的是 div 的 content 的宽高, clientHeight 获取的是 content+padding, offsetHeight 阅读全文
posted @ 2017-07-12 16:39 Y_Y1208 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 我们都知道,对于一行文本的垂直居中可以通过设置 height 与 line-height 值相等来实现。 那么对于两个嵌套的div ,或者一个div中的多行文本,怎么让被包含的部分实现垂直居中呢?显然,通过 line-height 没法实现。 其实,实现原理就是用外层div的高度减去内层 div 的 阅读全文
posted @ 2017-07-12 14:15 Y_Y1208 阅读(386) 评论(0) 推荐(0) 编辑