# match-media
Start from base library version 2.11.1. Please remaining backward compatible.
media query Match the detection node. You can specify a set media query This node will only be displayed if the rule is satisfied.
With this node, you can achieve the effect of "page width and height in a certain range only show a certain area."
attribute | type | Default value | Required | Introductions | Minimum version |
---|---|---|---|---|---|
min-width | number | no | Minimum page width px In units) | 2.11.1 | |
max-width | number | no | Maximum page width px In units) | 2.11.1 | |
width | number | no | Page width px In units) | 2.11.1 | |
min-height | number | no | Minimum page height px In units) | 2.11.1 | |
max-height | number | no | Maximum page height px In units) | 2.11.1 | |
height | number | no | Page height ( px In units) | 2.11.1 | |
orientation | string | no | Screen direction ( landscape or portrait ) | 2.11.1 |
# sample code
<match-media min-width="300" max-width="600">
<view>When the page width is 300 500 px Between the show here</view>
</match-media>
<match-media min-height="400" orientation="landscape">
<view>When the page height is not less than 400 px And the screen direction is vertical.</view>
</match-media>