| <!DOCTYPE html> |
| <!-- |
| | Sibling inline boxes of ancestor inline boxes that end up on the same line |
| | as a box can affect the line height. When combined with vertical-align:top |
| | or vertical-align:bottom, that affects vertical positioning of a box. |
| | https://www.w3.org/TR/CSS21/visudet.html#line-height |
| --> |
| <html> |
| <head> |
| <style> |
| body { |
| margin: 0px; |
| font-family: Roboto; |
| font-size: 16px; |
| } |
| .small-box { |
| display: inline; |
| font-size: 20px; |
| background-color: #2962FF; |
| } |
| .medium-box { |
| display: inline; |
| font-size: 30px; |
| background-color: #2979FF; |
| } |
| .large-box { |
| display: inline; |
| font-size: 60px; |
| background-color: #82B1FF; |
| } |
| </style> |
| </head> |
| <body> |
| |
| <span class="medium-box"> |
| text |
| <span style="vertical-align:top" class="small-box"> |
| top |
| </span> |
| </span> |
| <span class="large-box"> |
| big |
| </span> |
| |
| </body> |
| </html> |