Viewport Meta width=device-width Check

Detects an explicit width=device-width directive in viewport content split on commas or semicolons. Reports duplicate width directives rather than simulating browser viewport resolution.

Description

A viewport meta directive connects a page’s layout viewport to the device width.

A viewport meta directive connects a page’s layout viewport to the device width. Duplicate width directives can make the author’s intent harder to inspect.1

Detects an explicit width=device-width directive in viewport content split on commas or semicolons. Reports duplicate width directives rather than simulating browser viewport resolution.

When to use Viewport Meta width=device-width Check

Use this for the following task: Detects an explicit width=device-width directive in viewport content split on commas or semicolons. Reports duplicate width directives rather than simulating browser viewport resolution.

Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.

How to use Viewport Meta width=device-width Check and understand its results

  1. Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
  2. Enter content using the field table, then run the tool.
  3. Read hasDeviceWidth, widthDirectiveCount. Interpret flags, units, ordering and placeholder values using the rules below.
  4. Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
Input fieldMeaningValue type and boundsRequirement
contentContentstring; maximum text length 100000Required

Split content on commas or semicolons and trim ASCII whitespace. Count width assignments case insensitively; recognize device-width only when it occupies the complete assignment value.2

hasDeviceWidth = any exact width=device-width directive; widthDirectiveCount = number of width assignments

This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.

Output fieldMeaningValue type
hasDeviceWidthHas Device Widthboolean
widthDirectiveCountWidth Directive Countinteger
json
{
  "input": {
    "content": "width=device-width, initial-scale=1"
  },
  "output": {
    "hasDeviceWidth": true,
    "widthDirectiveCount": 1
  }
}

Limitations and assumptions

The presence flag does not resolve duplicate directives, zoom settings or actual browser layout.

This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.

Alternative or Complementary methods

Choose sizes Attribute Width Formula Lookup for this operation: Resolves the first matching sizes clause from parsed media flags and already-resolved nonnegative CSS pixel lengths. If none matches, source size defaults to viewport width (100vw). Auto sizes and CSS parsing are outside this profile. For a complementary task, use picture/source Art Direction Order for this operation: Chooses the first eligible picture source in document order from supplied media-match and format-support flags. Supply only source elements before the fallback img that have usable source sets. Reports selected element presence without fetching or selecting image candidates.

Further background: HTML / accessibility reference: Viewport Meta width=device-width Check.

References

  1. HTML / accessibility reference: Viewport Meta width=device-width Check — drafts.csswg.org

  2. Viewport Meta width=device-width Check — tool.io

Similar or alternative tools

  • sizes Attribute Width Formula Lookup

    Resolves the first matching sizes clause from parsed media flags and already-resolved nonnegative CSS pixel lengths. If none matches, source size defaults to viewport width (100vw). Auto sizes and CSS parsing are outside this profile.

  • picture/source Art Direction Order

    Chooses the first eligible picture source in document order from supplied media-match and format-support flags. Supply only source elements before the fallback img that have usable source sets. Reports selected element presence without fetching or selecting image candidates.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies