| <!DOCTYPE html> |
| <!-- |
| | line-height should not affect relative vertical placement of child boxes in a |
| | line box. https://www.w3.org/TR/CSS21/visudet.html#line-height |
| --> |
| <html> |
| <head> |
| <style> |
| body { |
| margin: 0px; |
| font-size: 20px; |
| font-family: Roboto; |
| font-weight: bold; |
| color: #F44336; |
| } |
| .middle { |
| vertical-align:middle; |
| } |
| .baseline { |
| vertical-align:baseline; |
| } |
| .top { |
| vertical-align:top; |
| } |
| .bottom { |
| vertical-align:bottom; |
| } |
| .light-box { |
| background-color:#2979FF; |
| padding:10px; |
| } |
| .dark-box { |
| background-color:#2962FF; |
| padding:10px; |
| } |
| </style> |
| </head> |
| <body> |
| <div style="line-height:100px; width:100px; background-color:#82B1FF;"> |
| <span class="middle dark-box"></span> |
| <span class="baseline light-box""></span> |
| <span class="top dark-box"></span> |
| <span class="bottom light-box""></span> |
| </div> |
| <div style="width:100px; background-color:#448AFF"> |
| <span class="middle dark-box"></span> |
| <span class="baseline light-box""></span> |
| <span class="top dark-box"></span> |
| <span class="bottom light-box""></span> |
| </div> |
| </body> |
| </html> |