Using em's to scale font size in responsive layout
-
- Experienced User
- Posts: 119
- Joined: Wed May 25, 2016 11:58 am
- First Name: Patti
- Last Name: Shuey
- Company Name: Conestoga Wood Specialties
- Phone: 7174452886
- Address 1: 645 Reading Road
- City: East Earl
- State / Province: Pennsylvania
- Zip / Postal Code: 17519
- Country: United States
- Contact:
Using em's to scale font size in responsive layout
I am using em's to define my font size in a responsive layout. I used the developer tools in chrome to determine that it is using the em font size, however, when I reduce my window to a smaller size, the font size does not change. I thought if I set the view port property to true, this scaling would work. Any idea where I am going wrong?
- matt.denninghoff
- Profound Logic Staff Member
- Posts: 115
- Joined: Wed Feb 10, 2016 3:53 pm
- First Name: Matthew
- Last Name: Denninghoff
- Company Name: Profound Logic Software
- State / Province: Ohio
- Country: United States
- Contact:
Re: Using em's to scale font size in responsive layout
It sounds like you'd like the font to resize with the viewport. According to this guide, https://www.w3schools.com/css/css_font.asp, the "em" is just relative to the current "font size", and a user can change some browser settings to change it (versus, say font-size: 12px, which is always 12px). I think you're looking for the "vw" unit--viewport-width. When you use a font-size: 1vw, the font width is 1% of the viewport width. So, if you resize the browser window (the viewport), then the font will resize.
The "use viewport" property of the Responsive Layout only makes a difference on the size of the layout's containers. By default, "use viewport" is true, so the style rules use the browser viewport to determine the size of the containers. When "use viewport" is false, then some JavaScript code tries to calculate the width of the Responsive Layout widget, and that width is what's used to determine the size of the containers.
The "use viewport" property of the Responsive Layout only makes a difference on the size of the layout's containers. By default, "use viewport" is true, so the style rules use the browser viewport to determine the size of the containers. When "use viewport" is false, then some JavaScript code tries to calculate the width of the Responsive Layout widget, and that width is what's used to determine the size of the containers.
-
- Experienced User
- Posts: 119
- Joined: Wed May 25, 2016 11:58 am
- First Name: Patti
- Last Name: Shuey
- Company Name: Conestoga Wood Specialties
- Phone: 7174452886
- Address 1: 645 Reading Road
- City: East Earl
- State / Province: Pennsylvania
- Zip / Postal Code: 17519
- Country: United States
- Contact:
Re: Using em's to scale font size in responsive layout
This is exactly what I was looking for! Thanks Matt!
Who is online
Users browsing this forum: No registered users and 15 guests