Skip to content

Commit c7a8b25

Browse files
Merge Viewport meta tag guide into reference (#41521)
* Merge Viewport meta tag guide into reference * Apply suggestions from code review Co-authored-by: sideshowbarker <[email protected]> --------- Co-authored-by: sideshowbarker <[email protected]>
1 parent 7307f1c commit c7a8b25

File tree

14 files changed

+62
-130
lines changed

14 files changed

+62
-130
lines changed

files/en-us/_redirects.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13314,6 +13314,7 @@
1331413314
/en-US/docs/Web/HTML/Global_attributes/translate /en-US/docs/Web/HTML/Reference/Global_attributes/translate
1331513315
/en-US/docs/Web/HTML/Global_attributes/virtualkeyboardpolicy /en-US/docs/Web/HTML/Reference/Global_attributes/virtualkeyboardpolicy
1331613316
/en-US/docs/Web/HTML/Global_attributes/writingsuggestions /en-US/docs/Web/HTML/Reference/Global_attributes/writingsuggestions
13317+
/en-US/docs/Web/HTML/Guides/Viewport_meta_element /en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport
1331713318
/en-US/docs/Web/HTML/Index /en-US/docs/Web/HTML
1331813319
/en-US/docs/Web/HTML/Inline_elemente /en-US/docs/Glossary/Inline-level_content
1331913320
/en-US/docs/Web/HTML/Inline_elements /en-US/docs/Glossary/Inline-level_content
@@ -13341,7 +13342,7 @@
1334113342
/en-US/docs/Web/HTML/Supported_media_formats /en-US/docs/Web/Media/Guides/Formats
1334213343
/en-US/docs/Web/HTML/The_Importance_of_Correct_HTML_Commenting /en-US/docs/Learn_web_development/Core/Structuring_content/Basic_HTML_syntax#HTML_comments
1334313344
/en-US/docs/Web/HTML/Using_HTML5_audio_and_video /en-US/docs/Learn_web_development/Core/Structuring_content/HTML_video_and_audio
13344-
/en-US/docs/Web/HTML/Viewport_meta_tag /en-US/docs/Web/HTML/Guides/Viewport_meta_element
13345+
/en-US/docs/Web/HTML/Viewport_meta_tag /en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport
1334513346
/en-US/docs/Web/HTML/element/content /en-US/docs/Web/HTML/Reference/Elements/slot
1334613347
/en-US/docs/Web/HTML/microformats /en-US/docs/Web/HTML/Guides/Microformats
1334713348
/en-US/docs/Web/HTTP/Access_control_CORS /en-US/docs/Web/HTTP/Guides/CORS

files/en-us/learn_web_development/core/accessibility/mobile/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ We've provided a simple example that shows how to use the mouse and touch events
221221

222222
In particular, the most common problems that need to be addressed for mobile are:
223223

224-
- Suitability of layouts for mobile devices. A multi-column layout won't work as well on a narrow screen, for example, and the text size may need to be increased so it is legible. Such issues can be solved by creating a responsive layout using technologies such as [media queries](/en-US/docs/Web/CSS/CSS_media_queries), [viewport](/en-US/docs/Web/HTML/Guides/Viewport_meta_element), and [flexbox](/en-US/docs/Learn_web_development/Core/CSS_layout/Flexbox).
224+
- Suitability of layouts for mobile devices. A multi-column layout won't work as well on a narrow screen, for example, and the text size may need to be increased so it is legible. Such issues can be solved by creating a responsive layout using technologies such as [media queries](/en-US/docs/Web/CSS/CSS_media_queries), [viewport](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport), and [flexbox](/en-US/docs/Learn_web_development/Core/CSS_layout/Flexbox).
225225
- Conserving image sizes downloaded. In general, small-screen devices won't need images that are as large as their desktop counterparts, and they are more likely to be on slow network connections. Therefore, it is wise to serve smaller images to narrow screen devices as appropriate. You can handle this using [responsive image techniques](/en-US/docs/Web/HTML/Guides/Responsive_images).
226226
- Thinking about high resolutions. Many mobile devices have high-resolution screens, and therefore need higher-resolution images so that the display can continue to look crisp and sharp. Again, you can serve images as appropriate using responsive image techniques. In addition, many image requirements can be fulfilled using the SVG vector images format, which is well-supported across browsers today. SVG has a small file size and will stay sharp regardless of whatever size is being displayed (see [Including vector graphics in HTML](/en-US/docs/Learn_web_development/Core/Structuring_content/Including_vector_graphics_in_HTML) for more details).
227227

@@ -234,7 +234,7 @@ There are other important issues to consider when making sites more accessible o
234234

235235
#### Not disabling zoom
236236

237-
Using [viewport](/en-US/docs/Web/HTML/Guides/Viewport_meta_element), it is possible to disable zoom. Always ensure resizing is enabled, and set the width to the device's width in the {{htmlelement("head")}}:
237+
Using [viewport](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport), it is possible to disable zoom. Always ensure resizing is enabled, and set the width to the device's width in the {{htmlelement("head")}}:
238238

239239
```html
240240
<meta name="viewport" content="width=device-width; user-scalable=yes" />

files/en-us/learn_web_development/core/css_layout/responsive_design/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ By setting `width=device-width` you are overriding a mobile device's default, li
481481

482482
**So you should _always_ include the viewport meta tag in the head of your documents.**
483483

484-
There are a number of other options you can put inside the `content` attribute of the viewport meta tag — see [Using the viewport meta tag to control layout on mobile browsers](/en-US/docs/Web/HTML/Guides/Viewport_meta_element) for more details.
484+
There are a number of other options you can put inside the `content` attribute of the viewport meta tag — see the [`<meta name="viewport">`](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport) reference for more details.
485485

486486
## Summary
487487

files/en-us/learn_web_development/extensions/testing/html_and_css/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ If you do need to include modern features, test for feature support using [`@sup
330330

331331
### Responsive design problems
332332

333-
Responsive design is the practice of creating web layouts that change to suit different device form factors — for example, different screen widths, orientations (portrait or landscape), or resolutions. A desktop layout for example will look terrible when viewed on a mobile device, so you need to provide a suitable mobile layout using [media queries](/en-US/docs/Web/CSS/CSS_media_queries), and make sure it is applied correctly using [viewport](/en-US/docs/Web/HTML/Guides/Viewport_meta_element). You can find a detailed account of such practices in [our responsive design tutorial](/en-US/docs/Learn_web_development/Core/CSS_layout/Responsive_Design).
333+
Responsive design is the practice of creating web layouts that change to suit different device form factors — for example, different screen widths, orientations (portrait or landscape), or resolutions. A desktop layout for example will look terrible when viewed on a mobile device, so you need to provide a suitable mobile layout using [media queries](/en-US/docs/Web/CSS/CSS_media_queries), and make sure it is applied correctly using [viewport](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport). You can find a detailed account of such practices in [our responsive design tutorial](/en-US/docs/Learn_web_development/Core/CSS_layout/Responsive_Design).
334334

335335
Resolution is a big issue too — for example, mobile devices are less likely to need big heavy images than desktop computers, and are more likely to have slower internet connections and possibly even expensive data plans that make wasted bandwidth more of a problem. In addition, different devices can have a range of different resolutions, meaning that smaller images could appear pixelated. There are a number of techniques that allow you to work around such problems, from [media queries](/en-US/docs/Learn_web_development/Core/CSS_layout/Responsive_Design#media_queries) to more complex [responsive image techniques](/en-US/docs/Web/HTML/Guides/Responsive_images#resolution_switching_different_sizes), including {{HTMLElement('picture')}} and the {{HTMLElement('img')}} element's [`srcset`](/en-US/docs/Web/HTML/Reference/Elements/img#srcset) and [`sizes`](/en-US/docs/Web/HTML/Reference/Elements/img#sizes) attributes.
336336

files/en-us/mdn/writing_guidelines/code_style_guide/html/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Finally, you should always add the viewport meta tag into your HTML {{HTMLElemen
5959
<meta name="viewport" content="width=device-width" />
6060
```
6161

62-
See [Using the viewport meta tag to control layout on mobile browsers](/en-US/docs/Web/HTML/Guides/Viewport_meta_element) for further details.
62+
See [`<meta name="viewport">`](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport) for further details.
6363

6464
## Attributes
6565

files/en-us/mozilla/firefox/releases/133/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This article provides information about the changes in Firefox 133 that affect d
1212

1313
### HTML
1414

15-
- The [`viewport <meta>` tag](/en-US/docs/Web/HTML/Guides/Viewport_meta_element) now supports the [`interactive-widget`](/en-US/docs/Web/HTML/Guides/Viewport_meta_element#the_effect_of_interactive_ui_widgets) attribute, this influences the size of the viewport when common UI widgets, such as virtual keyboards, are added to the screen. ([Firefox bug 1831649](https://bugzil.la/1831649) and [Firefox bug 1920755](https://bugzil.la/1920755)).
15+
- The [`viewport <meta>` tag](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport) now supports the [`interactive-widget`](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport#the_effect_of_interactive_ui_widgets) attribute, this influences the size of the viewport when common UI widgets, such as virtual keyboards, are added to the screen. ([Firefox bug 1831649](https://bugzil.la/1831649) and [Firefox bug 1920755](https://bugzil.la/1920755)).
1616

1717
### CSS
1818

files/en-us/web/api/htmlmetaelement/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ meta.content = "width=device-width, initial-scale=1";
6464
document.head.appendChild(meta);
6565
```
6666

67-
For more information on setting the viewport, see [Viewport basics](/en-US/docs/Web/HTML/Guides/Viewport_meta_element#viewport_basics).
67+
For more information on setting the viewport, see [`<meta name="viewport">`](/en-US/docs/Reference/Elements/meta/name/viewport).
6868

6969
## Specifications
7070

files/en-us/web/css/css_media_queries/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ The CSS media queries level 5 module also introduces the `environment-blending`,
126126
- HTML
127127
- `sizes` attribute for [`<img>`](/en-US/docs/Web/HTML/Reference/Elements/img#sizes), [`<link>`](/en-US/docs/Web/HTML/Reference/Elements/link#sizes), and [`<source>`](/en-US/docs/Web/HTML/Reference/Elements/source#sizes) for {{HTMLElement("picture")}}
128128
- `media` attribute for [`<link>`](/en-US/docs/Web/HTML/Reference/Elements/link#media), [`<source>`](/en-US/docs/Web/HTML/Reference/Elements/source#media), and [`<style>`](/en-US/docs/Web/HTML/Reference/Elements/style#media) [HTML](/en-US/docs/Web/HTML)
129-
- [Viewport `<meta>` tag](/en-US/docs/Web/HTML/Guides/Viewport_meta_element)
129+
- [`<meta name="viewport">`](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport)
130130
- SVG [`media`](/en-US/docs/Web/SVG/Reference/Attribute/media) attribute
131131

132132
## Specifications

files/en-us/web/css/cssom_view/viewport_concepts/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ window.outerHeight; /* 900 */
4949

5050
There are several DOM properties that can help you query viewport size, and other similar lengths:
5151

52-
- The document element's {{DOMxRef("Element.clientWidth")}} is the inner width of a document in [CSS pixels](/en-US/docs/Web/HTML/Guides/Viewport_meta_element#screen_density), including padding (but not borders, margins, or vertical scrollbars, if present). **This is the viewport width**.
52+
- The document element's {{DOMxRef("Element.clientWidth")}} is the inner width of a document in [CSS pixels](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport#screen_density), including padding (but not borders, margins, or vertical scrollbars, if present). **This is the viewport width**.
5353
- The {{DOMxRef("Window.innerWidth")}} is the width, in CSS pixels, of the browser window viewport including, if rendered, the vertical scrollbar.
5454
- The {{DOMxRef("Window.outerWidth")}} is the width of the outside of the browser window including all the window {{glossary("chrome")}}.
5555

@@ -170,8 +170,7 @@ The `width` property controls the size of the viewport. It should preferably be
170170

171171
- [CSSOM view](/en-US/docs/Web/CSS/CSSOM_view) module
172172
- [Visual Viewport API](/en-US/docs/Web/API/Visual_Viewport_API)
173-
- {{HTMLElement("meta")}}, specifically `<meta name="viewport">`
174-
- [Using the viewport meta tag to control layout on mobile browsers](/en-US/docs/Web/HTML/Guides/Viewport_meta_element)
173+
- {{HTMLElement("meta")}}, specifically [`<meta name="viewport">`](/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport)
175174
- [Visual Viewport API](/en-US/docs/Web/API/Visual_Viewport_API)
176175
- [CSS viewport](/en-US/docs/Web/CSS/CSS_viewport) module
177176
- [CSSOM view](/en-US/docs/Web/CSS/CSSOM_view) module

0 commit comments

Comments
 (0)