{"id":19505,"date":"2017-12-28T16:15:48","date_gmt":"2017-12-28T14:15:48","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=19505"},"modified":"2017-12-27T16:54:36","modified_gmt":"2017-12-27T14:54:36","slug":"html5-viewport-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/","title":{"rendered":"HTML5 Viewport Example"},"content":{"rendered":"<p>In this article we will take a look at what the Viewport is and how we can tweak it using the meta tag. To demonstrate the concept we will be building a sample application. I will take things one step at a time by first listing the tools &amp; technologies used before moving on to other details. Finally ending with a working copy of the application towards the end of this post. So, let&#8217;s get started then.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;tgm4cmEWcKUikZNn&#8217;]<\/p>\n<h2>1. Tools &amp; Technologies<\/h2>\n<p>To build the example application, I have used the following toolset. Some of them are required whilst others could be replaced by tools of your own choice.<\/p>\n<ol>\n<li><a href=\"https:\/\/nodejs.org\/en\/download\/\" target=\"_blank\" rel=\"noopener\">Nodejs v6.3.0<\/a><\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/package\/express\" target=\"_blank\" rel=\"noopener\">Express<\/a><\/li>\n<li><a href=\"https:\/\/code.visualstudio.com\/download\" target=\"_blank\" rel=\"noopener\">Visual Studio Code IDE<\/a><\/li>\n<\/ol>\n<p>Node.js in essence is JavaScript on the server-side. We use it along with the Express module to create a barebones web server to serve files and resources to the browser. I am comfortable with using Visual Studio Code IDE but you can choose any text editor of your choice.<\/p>\n<h2>2. Project Layout<\/h2>\n<p>The project structure of our example application is as follows:<\/p>\n<figure id=\"attachment_19884\" aria-describedby=\"caption-attachment-19884\" style=\"width: 364px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/html5.viewport.project.layout.jpg\"><img decoding=\"async\" class=\"size-full wp-image-19884\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/html5.viewport.project.layout.jpg\" alt=\"\" width=\"364\" height=\"310\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/html5.viewport.project.layout.jpg 364w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/html5.viewport.project.layout-300x255.jpg 300w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><\/a><figcaption id=\"caption-attachment-19884\" class=\"wp-caption-text\">Project Layout<\/figcaption><\/figure>\n<h2>3. Viewport<\/h2>\n<h3>3.1. What is Viewport?<\/h3>\n<p>A viewport, in web development parlance, is the screen area in which the web browser displays content. The viewport is closely tied to the concept of responsive design. When we attempt to build websites that adapts themselves to the device being used to view it, in essence, is called a responsive design. To build a website that is responsive we utilize media queries which allow us to enable different layouts for different screen sizes or browser viewports.<br \/>\nBut an issue with the media query approach is that they do not fire on the devices they are meant for. The reason being that the browser renders the web page in a virtual window and then displays the results shrunk to fit the viewport. Although mobile users were able to zoom into the area of interest on the page, the usability of webpages left a lot to be desired.<\/p>\n<p>To prevent the mobile devices from shrinking web pages we can leverage the meta tag to configure the viewport. A typical viewport meta tag looks like below:<\/p>\n<pre class=\"brush: html;\">&lt;head&gt;\r\n...\r\n&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;\r\n...\r\n&lt;\/head&gt;\r\n<\/pre>\n<p>What this does is tell the browser to not shrink the page. Which allows our media queries to fire and take effect. The css applied as a result of media queries firing leads to a world of improvement in user experience.<br \/>\nThe meta tag used to configure the viewport accepts the following key-value pairs, separated by commas.<\/p>\n<table>\n<thead>\n<tr>\n<th>Key<\/th>\n<th>Values<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>width<\/td>\n<td>Size in pixels or the special value device-width<\/td>\n<td>Sets the width of the page to the width of the screen<\/td>\n<\/tr>\n<tr>\n<td>initial-scale<\/td>\n<td>Numeric value<\/td>\n<td>Sets the initial zoom level of the page<\/td>\n<\/tr>\n<tr>\n<td>maximum-scale<\/td>\n<td>Numeric value<\/td>\n<td>Sets the maximum zoom level of the page,<br \/>\nAvoid specifying this value and leave the user in charge of the same.<\/td>\n<\/tr>\n<tr>\n<td>minimum-scale<\/td>\n<td>Numeric value<\/td>\n<td>Sets the value indicating how much the user can zoom out. Avoid specifying this value.<\/td>\n<\/tr>\n<tr>\n<td>height<\/td>\n<td>Size in pixels to set the height of the viewport.<br \/>\nAlthough support for this is scant at best.<\/td>\n<td>Avoid using or setting a value for this as it is not supported widely.<\/td>\n<\/tr>\n<tr>\n<td>user-scalable<\/td>\n<td>Can be set to no<\/td>\n<td>When set to no it prevents the user from zooming in.<br \/>\nAbsolutely avoid setting this value.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In the next section we will build an application to demonstrate these concepts.<\/p>\n<h3>3.2. Using meta tag to tweak Viewport<\/h3>\n<p>In our application we create two pages, namely, <code>index.html<\/code> &amp; <code>withoutmetatag.html<\/code>. The first page will have the Viewport meta tag whereas the second one will not. We will try to create layout with three breakpoints using media queries. Meaning that the UI layout will adapt itself to three screen sizes by modifying its layout to adjust to the screen sizes. First of all let us look at the markup we need to add to our two <code>html<\/code> files.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>index.html<\/em><\/span><\/p>\n<pre class=\"brush: html;\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n    &lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt;\r\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;\r\n&lt;!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --&gt;\r\n    &lt;title&gt;WCG -- HTML5 Viewport Example&lt;\/title&gt;\r\n\r\n    &lt;link rel=\"Stylesheet\" href=\"css\/html5.viewport.css\"\/&gt;\r\n&lt;!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --&gt;\r\n&lt;!-- WARNING: Respond.js doesn't work if you view the page via file:\/\/ --&gt;\r\n&lt;!--[if lt IE 9]&gt;\r\n&lt;script src=\"https:\/\/oss.maxcdn.com\/html5shiv\/3.7.3\/html5shiv.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/oss.maxcdn.com\/respond\/1.4.2\/respond.min.js\"&gt;&lt;\/script&gt;\r\n&lt;![endif]--&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;h1&gt;WCG -- HTML5 Viewport Example&lt;\/h1&gt;\r\n\r\n        &lt;div class=\"column red\"&gt;&lt;\/div&gt;\r\n        &lt;div class=\"column green\"&gt;&lt;\/div&gt;\r\n        &lt;div class=\"column blue\"&gt;&lt;\/div&gt;\r\n\r\n        &lt;script src=\"js\/html5.viewport.js\"&gt;&lt;\/script&gt;\r\n\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>withoutmetatag.html<\/em><\/span><\/p>\n<pre class=\"brush: html;\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=\"utf-8\"&gt;\r\n        &lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt;\r\n\r\n&lt;!-- The above 2 meta tags *must* come first in the head; any other head content must come *after* these tags --&gt;\r\n        &lt;title&gt;WCG -- HTML5 Viewport Example&lt;\/title&gt;\r\n\r\n        &lt;link rel=\"Stylesheet\" href=\"css\/html5.viewport.css\"\/&gt;\r\n&lt;!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --&gt;\r\n&lt;!-- WARNING: Respond.js doesn't work if you view the page via file:\/\/ --&gt;\r\n&lt;!--[if lt IE 9]&gt;\r\n&lt;script src=\"https:\/\/oss.maxcdn.com\/html5shiv\/3.7.3\/html5shiv.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/oss.maxcdn.com\/respond\/1.4.2\/respond.min.js\"&gt;&lt;\/script&gt;\r\n&lt;![endif]--&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;h1&gt;WCG -- HTML5 Viewport Example&lt;\/h1&gt;\r\n\r\n        &lt;div class=\"column red\"&gt;&lt;\/div&gt;\r\n        &lt;div class=\"column green\"&gt;&lt;\/div&gt;\r\n        &lt;div class=\"column blue\"&gt;&lt;\/div&gt;\r\n\r\n        &lt;script src=\"js\/html5.viewport.js\"&gt;&lt;\/script&gt;\r\n\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Now we create our <code>html5.viewport.css<\/code> to create the layout with breakpoints using media queries.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>html5.viewport.css<\/em><\/span><\/p>\n<pre class=\"brush: css;\">@media screen and (min-width: 1024px ){\r\n    .column{\r\n        width: 30%;\r\n        margin: 5px;\r\n        display: inline-block;\r\n    }\r\n}\r\n@media screen and (max-width: 768px) and (min-width: 425px ){\r\n    .column{\r\n        width: 45%;\r\n        margin: 5px;\r\n        display: inline-block;\r\n    }\r\n}\r\n@media screen and (max-width: 425px ){\r\n    .column{\r\n        width: 96%;        \r\n        margin: 5px;\r\n        display: inline-block;\r\n    }\r\n}\r\n.red{\r\n    background-color: red;\r\n    height: 150px;\r\n}\r\n.blue{\r\n    background-color: blue;\r\n    height: 150px;\r\n}\r\n.green{\r\n    background-color: green;\r\n    height: 150px;\r\n}\r\n<\/pre>\n<p>As you can see in the above css and markup, we have added three breakpoints in css to apply for three different screen sizes, viz., Laptop &amp; above, Tablets &amp; Smartphones. We have added three <code>div<\/code> which appear in the same row on a laptop and spill into two rows on a tablet screen and three rows on a smartphone. Now, we are all set so let us run the application and see the results in the next section.<\/p>\n<h3>3.3. Results<\/h3>\n<p>The <code>index.html<\/code> looks like below on the three screen sizes.<\/p>\n<figure id=\"attachment_19897\" aria-describedby=\"caption-attachment-19897\" style=\"width: 738px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WithMetaTagIndexHTML.jpg\"><img decoding=\"async\" class=\"size-full wp-image-19897\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WithMetaTagIndexHTML.jpg\" alt=\"\" width=\"738\" height=\"711\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WithMetaTagIndexHTML.jpg 738w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WithMetaTagIndexHTML-300x289.jpg 300w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><\/a><figcaption id=\"caption-attachment-19897\" class=\"wp-caption-text\">Index.html with Meta Tag<\/figcaption><\/figure>\n<p>The <code>withoutmetatag.html<\/code> looks like below on the three screen sizes.<\/p>\n<figure id=\"attachment_19895\" aria-describedby=\"caption-attachment-19895\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WithoutMetaTag.jpg\"><img decoding=\"async\" class=\"size-full wp-image-19895\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WithoutMetaTag.jpg\" alt=\"\" width=\"756\" height=\"624\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WithoutMetaTag.jpg 756w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WithoutMetaTag-300x248.jpg 300w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/a><figcaption id=\"caption-attachment-19895\" class=\"wp-caption-text\">withoutmetatag.html<\/figcaption><\/figure>\n<p>As we can see from the above screen grabs on the three screen sizes, the results are quite dramatic with the use of Viewport Meta tag. Overall the meta tag allows us to provide a much better experience across devices with varying screen sizes.<\/p>\n<h2>4. Running the Project<\/h2>\n<p>To run the project you need to execute the following commands at the root of the project.<\/p>\n<pre class=\"brush: bash;\">&gt; npm install\r\n<\/pre>\n<p>then<\/p>\n<pre class=\"brush: bash;\">&gt; node index.js\r\n<\/pre>\n<p>Now, navigate to the URL <code>http:\/\/localhost:8090\/index.html<\/code> and <code>http:\/\/localhost:8090\/withoutmetatag.html<\/code><\/p>\n<h2>5. Download the Source Code<\/h2>\n<p>This wraps up this post on the HTML5 Viewport Meta Tag.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WCG-HTML5-Viewport-Example.zip\"><strong>WCG &#8212; HTML5 Viewport Example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article we will take a look at what the Viewport is and how we can tweak it using the meta tag. To demonstrate the concept we will be building a sample application. I will take things one step at a time by first listing the tools &amp; technologies used before moving on to &hellip;<\/p>\n","protected":false},"author":213,"featured_media":914,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[58,507],"class_list":["post-19505","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html5","tag-html5-2","tag-viewport"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HTML5 Viewport Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this article we will take a look at what the Viewport is and how we can tweak it using the meta tag. To demonstrate the concept we will be building a\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTML5 Viewport Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this article we will take a look at what the Viewport is and how we can tweak it using the meta tag. To demonstrate the concept we will be building a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-28T14:15:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Siddharth Seth\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Siddharth Seth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/\"},\"author\":{\"name\":\"Siddharth Seth\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592\"},\"headline\":\"HTML5 Viewport Example\",\"datePublished\":\"2017-12-28T14:15:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/\"},\"wordCount\":901,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"keywords\":[\"html5\",\"viewport\"],\"articleSection\":[\"HTML5\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/\",\"name\":\"HTML5 Viewport Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"datePublished\":\"2017-12-28T14:15:48+00:00\",\"description\":\"In this article we will take a look at what the Viewport is and how we can tweak it using the meta tag. To demonstrate the concept we will be building a\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML5\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/html5\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"HTML5 Viewport Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592\",\"name\":\"Siddharth Seth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"caption\":\"Siddharth Seth\"},\"description\":\"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/siddharth-seth\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTML5 Viewport Example - Web Code Geeks - 2026","description":"In this article we will take a look at what the Viewport is and how we can tweak it using the meta tag. To demonstrate the concept we will be building a","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/","og_locale":"en_US","og_type":"article","og_title":"HTML5 Viewport Example - Web Code Geeks - 2026","og_description":"In this article we will take a look at what the Viewport is and how we can tweak it using the meta tag. To demonstrate the concept we will be building a","og_url":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-12-28T14:15:48+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","type":"image\/jpeg"}],"author":"Siddharth Seth","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Siddharth Seth","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/"},"author":{"name":"Siddharth Seth","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592"},"headline":"HTML5 Viewport Example","datePublished":"2017-12-28T14:15:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/"},"wordCount":901,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","keywords":["html5","viewport"],"articleSection":["HTML5"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/","url":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/","name":"HTML5 Viewport Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","datePublished":"2017-12-28T14:15:48+00:00","description":"In this article we will take a look at what the Viewport is and how we can tweak it using the meta tag. To demonstrate the concept we will be building a","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-viewport-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"HTML5","item":"https:\/\/www.webcodegeeks.com\/category\/html5\/"},{"@type":"ListItem","position":3,"name":"HTML5 Viewport Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592","name":"Siddharth Seth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","caption":"Siddharth Seth"},"description":"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.","sameAs":["https:\/\/www.webcodegeeks.com"],"url":"https:\/\/www.webcodegeeks.com\/author\/siddharth-seth\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/19505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/213"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=19505"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/19505\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/914"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=19505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=19505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=19505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}