Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <style>
    .demo1, .demo2 {
      border: 1px solid black;
      line-height: 0;
    }
    
    .demo2 {
      background: yellow;
    }
    
    .demo2 {
      line-height: 100px;
    }
    
    .demo3 {
      border: 1px solid blue;
    }
    .demo3 span {
      line-height: 0;
    }
    .demo3 {
      font-size: 0;
      line-height: 0;
    }
    .demo3 span {
      font-size: 52px;
    }
  </style>
</head>
<body>
<!--   给div和span元素设置line-height为0,为什么div几乎失去了高度,但span的高度没有受到影响?-->  
  <div class="demo1">demo1 demo1 demo1</div>
  <span class='demo2'>demo2 demo2 demo2</span>
  <div class="demo3">
    X<span>demo3 demo3 demo3</span>
  </div>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers