V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Can I use?
http://caniuse.com/
Less
http://lesscss.org
Cool Libraries
Bootstrap from Twitter
Jetstrap
hblevins
V2EX  ›  CSS

给 div 和 span 元素设置 line-height 为 0,为什么 div 几乎失去了高度,但 span 的高度没有受到影响?

  •  
  •   hblevins · 4 天前 · 297 次点击
    3 条回复    2024-06-27 13:32:16 +08:00
    QAQqingju
        1
    QAQqingju  
       4 天前
    块级元素和行内元素
    tool2dx
        2
    tool2dx  
       4 天前
    这属于 css 基本知识了。一个是 block 元素,另一个是 inline 元素。

    inline 元素设置高度,只能用过设置字体的大小,也就是 font-size ,你设置 line-height 没用。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3479 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:27 · PVG 12:27 · LAX 21:27 · JFK 00:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.