There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.Close
Processing...
This may take a few seconds.

if-media-max-width

Syntax

if-media-max-width: (width)px;

This conditional action will return true if the page has a maximum width as specified. You would use this for responsive websites to only run certain commands when the screen had a certain width. For example, you might have a menu with different actions to run when displayed on a mobile or desktop.

width = The maximum width of the page to check, including "px" at the end if applicable.

For example, this will return true if the page has a maximum width of 720px:

@conditional smallDevice {
    if-media-max-width: 720px;
}

Note: This command is shorthand for window.matchMedia('all and (max-width: xx)').

if-media-max-width