Setting Browser Zoom
-
- Jr. Propeller Head
- Posts: 4
- Joined: Tue Aug 29, 2017 8:00 am
Setting Browser Zoom
When generating an HTML5 Top Nav output, is it possible to force the browser in which it opens to zoom to a particular level? My output looks good when opened on certain monitors, but not on others with a lower resolution unless it's zoomed out. Is it possible to set the zoom level to say, 80% regardless of the browser?
-
- Senior Propellus Maximus
- Posts: 2089
- Joined: Tue Mar 07, 2006 5:06 pm
- Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
- Contact:
Re: Setting Browser Zoom
If you conduct a search you will find some sites, such as stackoverflow, have javascript for manipulating browser zoom.
It is (in my opinion) a bad practice. An application should never set a zoom level, the user might well have a good reason to select their own setting. This includes visual impairment or the physical size of the display.
It is (in my opinion) a bad practice. An application should never set a zoom level, the user might well have a good reason to select their own setting. This includes visual impairment or the physical size of the display.
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Re: Setting Browser Zoom
Do not set the zoom level - it's unnecessary, as well as bad practice.
Instead, use responsive design to change the font size based on the screen size.
First, set all font sizes in your project to use em units, so that they're relative.
Then set up media queries to set the body tag font size at different screen sizes, which will set the size of 1em; e.g.
Instead, use responsive design to change the font size based on the screen size.
First, set all font sizes in your project to use em units, so that they're relative.
Then set up media queries to set the body tag font size at different screen sizes, which will set the size of 1em; e.g.
Code: Select all
@media only screen and (max-width: 1280px)
{
body
{
font-size: 14px;
}
}
@media only screen and (min-width: 1280px)
{
body
{
font-size: 20px;
}
}
-
- Senior Propellus Maximus
- Posts: 4293
- Joined: Thu Feb 02, 2006 9:29 am
- Location: The Electric City
Re: Setting Browser Zoom
I second that setting the zoom level is pointless. The user can very quickly change that and probably is forced to do so anyway in those case where 80% is not enough. Responsive design is clearly the way to go.
New Book: Creating user-friendly Online Help
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
-
- Jr. Propeller Head
- Posts: 4
- Joined: Tue Aug 29, 2017 8:00 am
Re: Setting Browser Zoom
Thanks, all! I wasn't thinking about responsive design in terms of screen resolution, but will definitely help make the font size work in all situations.