Mobile Phone page Media query phone height width

Source: Internet
Author: User
First use JQ to get the phone's width high

Alert (window.screen.width+ "," +window.screen.height+ "; +$ (window). Width () + ', ' +$ (window). Height ());

where $ (window). Height () is the screen height of the phone px My is Huawei Imagine 5 This value is 923 because the height of the design drawings is 1070px and the Apple phone is much larger than this height is about 1130-1100, so use 1070-bit tipping point

@media screen and (max-height:1070px) {

Here is the style of the residue Android phone height less than 1070

. p3-flower{
Width:230px;height:221px;z-index:10;
position:absolute;top:0%;left:19%;
}}
@media screen and (min-height:1070px) {//This is the height of the apple and the 1070 notation
. p3-flower{
Width:230px;height:221px;z-index:10;
position:absolute;top:6%;left:19%;
}
Here I have detected the screen height of the phone, but also can detect the width of the screen @media screens and (min-width:640px) {} Media query is profound in addition to query the screen can also query the other specific I will not, we can find more information Note: The style of media query is also an element will have more than one set of styles must be written in the media query inside, not at the end of writing a set because the media query before the rendering, but to the back will be rendered, this is a big pit, I was in the test is to make this mistake wasted a lot of time

Mobile Phone page Media query phone height width

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.