For accurate interpretation and optimal search engine indexing, it’s crucial to define both the language and character encoding <meta charset=”charset”> as early as possible within an HTML document.
<!DOCTYPE html> <html lang=”en-us”> <head> <meta charset=”UTF-8″> <title>Page Title</title> </head> |
The viewport on web pages refers to the visible area that adjusts based on the device, being smaller on mobile phones. It’s recommended to include the following <meta>
element on all pages.
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″> |
This meta tag directs the browser on page scaling and dimensions. “width=device-width” adapts the page to the screen width, and “initial-scale=1.0” sets the default zoom level. Below is an illustration showing the difference before and after adding the viewport meta tag.