I am learning about letter spacing. I am using the em unit here for letter spacing. The element on which I use the unit does not have any parent except html. But if I change the font size of the HTML, the letter spacing does not change.
At first, the HTML tags were not present in this code. I tried adding them to see if it works. I also tried to set font-size at :root, but none worked.
html {
font-size: 2px
}
h1 {
font-family: 'COUTUREBold';
margin: 0;
font-size: 38px;
}
.wide {
font-size: 24px;
letter-spacing: .5em;
}
.narrow {
font-size: 48px;
letter-spacing: -.15em;
}
<link rel="stylesheet" media="screen" href="https://fontlibrary.org//face/couture" type="text/css" />
<h1>Hello World!</h1>
<h1 class="wide">Hello World!</h1>
<h1 class="narrow">Hello World!</h1>
If you want the letter spacing to be affected by the font size of the
htmlelement, you can use theremunit instead ofemfor letter spacing. Theremunit is relative to the root element's font size, which is, in most cases, the html element. You'd want to change all mentions ofemintoremin your code.For example:
Would become:
Not sure whether I'm correct on whether this is what you want to do, but I hope it helps.