I'm considering using clamp() in a current project but I'm unsureI meant:
exactly how it can be used.
As I understand it the middle of the three parameters, that clamp()
expects, is the preferred size and is or should be of a type that will
vary with the size of the viewport eg 10vw.
This works fine for a P in which all the text is the same size but if I
have an ARTICLE that contains text that needs to be at differing sizes relative to other text in the ARTICLE how is that achieved?
For example, if I have this
<article>
<p class="large">This is large text.</p>
<p class="medium">This is medium text.</p>
<p class="small">This is small text.</p>
</article>
Here 'large' is always 10% larger than 'medium' text which is itself 10% larger than 'small' text. Would something like this be appropriate:
article {
clamp: (16px, 5vw, 50px);
}
.large {
font-size: 110%;
}
.medium {
font-size: 100%;
}
.small {
font-size: 90%;
}
Andrew Poulos
On 1/06/2021 3:13 pm, Andrew Poulos wrote:
I'm considering using clamp() in a current project but I'm unsure
exactly how it can be used.
As I understand it the middle of the three parameters, that
clamp() expects, is the preferred size and is or should be of a
type that will vary with the size of the viewport eg 10vw.
This works fine for a P in which all the text is the same size but
if I have an ARTICLE that contains text that needs to be at
differing sizes relative to other text in the ARTICLE how is that
achieved?
For example, if I have this
<article>
<p class="large">This is large text.</p>
<p class="medium">This is medium text.</p>
<p class="small">This is small text.</p>
</article>
Here 'large' is always 10% larger than 'medium' text which is
itself 10% larger than 'small' text. Would something like this be
appropriate:
article {
clamp: (16px, 5vw, 50px);
I meant:
font-size: clamp(16px, 5vw, 50px);
}
.large {
font-size: 110%;
}
.medium {
font-size: 100%;
}
.small {
font-size: 90%;
}
I'm considering using clamp()
in a current project but I'm unsure exactly how it can be used.
As I understand it the middle of the three parameters, that clamp()
expects, is the preferred size and is or should be of a type that will
vary with the size of the viewport eg 10vw.
This works fine for a P in which all the text is the same size but if I
have an ARTICLE that contains text that needs to be at differing sizes relative to other text in the ARTICLE how is that achieved?
Andrew Poulos wrote:
I'm considering using clamp()
I have been waiting for such a feature for ages :-)
in a current project but I'm unsure exactly how it can be used.
As I understand it the middle of the three parameters, that clamp()
expects, is the preferred size and is or should be of a type that will
vary with the size of the viewport eg 10vw.
This works fine for a P in which all the text is the same size but if I
have an ARTICLE that contains text that needs to be at differing sizes
relative to other text in the ARTICLE how is that achieved?
Have you already read
<https://developer.mozilla.org/en-US/docs/Web/CSS/clamp()>
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 72:13:17 |
Calls: | 6,657 |
Calls today: | 3 |
Files: | 12,203 |
Messages: | 5,332,304 |
Posted today: | 1 |