CSS行高line-height默认值normal以及line-height与盒子的关系
来源:互联网 发布:fifa online3网络延迟 编辑:程序博客网 时间:2024/05/22 17:07
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><style type="text/css">body {margin: 0;padding: 0;}.box1 {font-size: 20px;line-height: 0;border: 1px solid #ccc;background: #eee;margin-top: 20px;}.box2 {font-size: 0;line-height: 20px;border: 1px solid #ccc;background: #eee;margin-top: 50px;}</style><body><div class="box1">盒子1</div><div class="box2">盒子2</div></body></html>
结果:box1盒子有文字大小,line-height设置为0;box2盒子文字大小设置为0,line-height为20px。结果显示box2盒子的高度为20px(当然盒子的高度还要加上border,box2盒子高度22px),说明撑开盒子高度的是line-height不是文字内容
注:line-height的默认值为normal,大家常理解normal相当于line-height的值是1或者1.2,当line-height值为数字时,表示是font-size的倍数。经Chrome测试,默认line-height值是font-size的1.3倍。line-height复杂,暂且理解这么多
阅读全文
1 0
- CSS行高line-height默认值normal以及line-height与盒子的关系
- css行高line-height的介绍
- css的行高Line Height属性
- css行高line-height的用法
- 行高 line-height
- CSS行高——line-height
- css 行高——line-height
- CSS行高——line-height
- CSS行高——line-height
- CSS行高——line-height
- CSS行高——line-height
- CSS行高——line-height
- CSS行高——line-height
- 深入理解css 行高”line-height
- CSS行高——line-height
- CSS行高——line-height
- CSS行高——line-height
- CSS行高——line-height
- WebRTC peer之间通讯过程
- spring data jpa 与 jpa的区别
- 数据库三大范式
- Rasberry Pi3B RASBIAN+LAMP 安装笔记
- libevent http库-使用示例
- CSS行高line-height默认值normal以及line-height与盒子的关系
- 点击跳转页面并执行跳转页面中的某个函数
- SLAM学习之Pangolin安装
- [Vijos1864]NOIP2013提高Day2华容道
- Ubuntu的FireFox无法使用HTML5播放器的解决方法
- Jzoj2934 字符串函数
- Java8 I/O源码-目录
- 象棋比赛(排序)
- 顺序表应用1:多余元素删除之移位算法