惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
V
V2EX
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
博客园 - 叶小钗
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
D
DataBreaches.Net
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
IT之家
IT之家
The Hacker News
The Hacker News
The Cloudflare Blog
T
Threatpost
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Proofpoint News Feed
I
InfoQ
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Troy Hunt's Blog
罗磊的独立博客
P
Privacy International News Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security @ Cisco Blogs
Latest news
Latest news
D
Docker
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Help Net Security
Help Net Security
云风的 BLOG
云风的 BLOG
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
腾讯CDC
L
LINUX DO - 最新话题
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
W
WeLiveSecurity
Forbes - Security
Forbes - Security
T
Threat Research - Cisco Blogs
美团技术团队
L
LINUX DO - 热门话题
Know Your Adversary
Know Your Adversary
O
OpenAI News

博客园 - feenan

AngularJS 源码分析3 AngularJS 源码分析2 AngularJS 源码分析1 javascript 中关于对象转换数字值的一些特点 转 CSS hack:针对IE6,IE7,firefox显示不同效果 CSS关于元素垂直居中的问题 (转)雅虎WEB前端网站优化 -- 34条军规 一个比较常用的关于php下的mysql数据操作类 Js中的一个日期处理格式化函数 Underscore.js 1.3.3 源码分析收藏 Backbone.js 0.9.2 源码分析收藏 Nodejs实现的一个静态服务器例子 Javascript MVC学习杂记3 Javascript MVC学习杂记2 Javascript MVC学习杂记1 C语言实现的一个简单的HTTP程序 C语言string.h中常用字符函数介绍 通过日期生成星期几 Javascript 模块化编程
CSS中一些不经意的细节问题1
feenan · 2013-11-07 · via 博客园 - feenan

    CSS这样的语法,细节问题非常多,往往一些难以处理的问题,有可能是一些细节问题不到位,所以先记下一些,留给以后自己看看。

1.line-height:150%与line-height:1.5 的区别

 .main{
   font-size:12px;
   line-height:150%;
   margin:20px;
   border:1px solid #ccc;
 }
 
 .main p{
   font-size:20px;
 }
<div class="main">
    <p>This is a test!</p>
</div>

当父容器为line-height:150%时,子元素P的line-height是按父容器的font-size*line-height来计算得出的是为18px;

然后当父容器为line-height:1.5时

 .main{
   font-size:12px;
   line-height:1.5;
   margin:20px;
   border:1px solid #ccc;
 }
 
 .main p{
   font-size:20px;
 }

子元素P的line-height是按父容器的line-height*自己的font-size计算得出的,所以是30px;

虽然是一个小问题,但是在排版的时候,不注意的话,会有意想不到的效果的。