1

I have 2 "span" blocks of text, which I want to "merge together" using display: inline. However, I want the line height to be consistent regardless of the browser size. For the font size, I'm using "vw" units, since I want it to scale according to the browser width.

https://jsfiddle.net/darrengates/jpLaf683/

When viewed at a large dimension (e.g. 1200px), the text looks fine, i.e:

this is the first block this is the first block this is the first block
this is the first block this is the first block this is the first block
this is the first block this is the first block this is the first block
this is the first block this is the second block... (etc.)

However, when the browser is sized to a very small dimension (e.g. 500px), the spacing between the lines starts to look very large. In fact, it seems like there is a whole line space between lines, for example:

this is the first block this is the first block this is the first block

this is the first block this is the first block this is the first block

this is the first block this is the first block this is the first block

this is the first block this is the second block... (etc.)

What I want it to do is scale the font down to a very small size, but keep the line spacing so that it looks consistent regardless of browser size. Assume that I cannot change the HTML itself, but must do this with CSS only. Also assume that I have to use VW units for the font size.

Darren Gates
  • 473
  • 2
  • 18

1 Answers1

6

It appears that using

line-height: 0 

in the parent container allows me to set individual line-height values in the child inline containers. Here an example of something that works for me at all screen dimensions:

https://jsfiddle.net/darrengates/L85xke8b/

Darren Gates
  • 473
  • 2
  • 18