I have a client provided website of width 1440 pixels. The client has asked me to set the viewport to 1440 pixels using for desktop browsers so that for screens smaller than 1440 pixels do no show a scrollbar.
It does work for mobile, ipad devices where we can can set the viewport using this. Does this work for desktop browsers as well?
I tried setting the viewport using this but could see a scrollbar. Could someone provide some thoughts on this.
code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=1440">
</head>
<body>
<div style="width:1440px;">
test content
</div>
</body>
</html>
Thanks
Generally, meta elements (including viewport) should be placed in the document's <head> . CSS rules should either be added to a CSS stylesheet and referenced with a <link> element or, if you're not using stylesheets for some reason, in a <style> element (also in the document's <head> ).
A <meta> viewport element gives the browser instructions on how to control the page's dimensions and scaling. The user-scalable attribute defines whether users can scale (zoom) the page content on mobile.
Setting The ViewportThe width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device). The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.
The viewport is the user's visible area of a web page. It varies with the device - it will be smaller on a mobile phone than on a computer screen. This gives the browser instructions on how to control the page's dimensions and scaling.
No.
When the first iPhone was released, it needed to be able to display webpages designed for viewing on computers with much larger displays. Since that was almost all websites, it defaulted to performing zoom tricks to fake having a display that size.
Meta viewport was introduced so that authors could tell the iPhone that they knew what they were doing and had actually considered mobile sized devices.
There was never a need for that on computer screen sized displays, so no support for meta viewport has ever been introduced outside of mobile browsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With