I have a div
and I want its font-size
to be a percentage of its width.
I can mark the div
with container-type: inline-size;
, put in another div
and set its font-size
in cqw
units. It works.
Is there a way to avoid adding the second div and set the font-size
directly? It seems, a container width cannot be referenced by the container itself:
div.mydiv
{
container-type: inline-size;
font-size: 3cqw; /* Browsers look for another container above. */
}