I’m using Font-size: calc(100% + 0.3vw) to calculate font sizes dependent on viewport width, however Internet Explorer is giving me a tiny font size, although I believe that it does support it. I am using IE 11.
Am I doing something wrong or do I need to find an IE workaround?
I have not tried or tested this but I assume that although the newer IE supports both calc and vw, it possibly does not like the two together.
See the Known Issues IE has with calc.
I would not be surprised if you have just found another one based on this.
Be careful with that as mobile browsers actually need bigger fonts rather than smaller fonts for readable text so make sure you have media queries for smaller screens to cater for this. As long as you are starting from a base that is suitable for smaller screens then you should be ok.
<ot>
In Zell Liew’s article, some of his snippits are written in SCSS. Is he being presumptive or are CSS coders expected to have an SCSS compiler on their computers these days? </ot>
My comment was pending but seems to have disappeared now. Maybe the link to Sitepoint was seen as spam? Or maybe there’s just a long delay before comments appear.
I didn’t pick up on that, he doesn’t mention SASS mixin until the end.
I thought this bit was kind of stupid:-
The first thing I tried to do was to create a <h1> element thats twice the size of the body text. It turned out that it wasn’t straightforward to do so
and after some lengthy over-complex attempts says:-
Eventually, the cleanest way I found is to revert to using Rem and Em. Why discard good ol’ units for shiny new ones? html { font-size: calc(112.5% + 0.25vw) } h1 { font-size: 2em; }
Isn’t that the first thing you would try?
But still it’s one way of putting the stops of text getting too small with vw without nedding a query.
I’ve been working on a design with big header text using vw. I had a query either end to put the stops on it, I later removed the top end one so it can go massive on huge screens, why not if it fits?