<! DOCTYPE html>
Mobile-side Font font-familyBody {font-family: "Helvetica Neue", Helvetica, Stheiti, Sans-serif;}
CSS3 Multi-Text line wrappingp { Overflow:hidden; text-overflow:ellipsis; Display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;}
Fixed scrambling of the input box under iOSIn iOS, when the style of a text box is fixed, if the text box has the focus, its position will be lost, because the iOS is self-adaptive centering, the fixed text box will run to the middle of the page. Similar:
(Please forgive the theft chart, I was wrong)
The solution has the following two:
1, the text box can be the focus of the time to change the fixed to absolute, lose focus when changing back to fixed, but this will make the screen has the experience of sliding up and down is not very good.
. fixfixed {Position:absolute;} $ (document). On (' Focus ', ' input ', function (e) { $ (this). addclass (' fixfixed ');}). On (' Blur ', ' input ', function (e) { $ (this). Removeclass (' fixfixed ');})
2, there is a fake fixed text box placed at the top of the page, a absolute text box hidden at the top of the page, when the fixed text box to get the focus of the time to hide it, and then display the absolute text box, when the focus is lost, The absolute text box is hidden and the fixed text box is displayed.
{position:absolute;} $ (document) { $absolute: Show (); $ (this). Hide (); } ) { $fixed: Show (); $ (this). Hide (); } );
Fast rebound scrollingAdd the following CSS to the scrolling place, and the slide will be especially smooth. There is no such thing as a card-and-card phenomenon. Mainly for the iOS machine, I think this is very practical
. div { overflow:auto; -webkit-overflow-scrolling:touch; }
Hide native scroll bars when iOS and Android scroll locally. ennoblelist::-webkit-scrollbar { opacity:0;}. ennoblelist::-webkit-scrollbar:horizontal { opacity:0;}
Prohibit ios&android long time download picture. CSS {-webkit-touch-callout: None}
BaniOS and Android user selected text . CSS {-webkit-user-select:None}
Using the Flexible box box layoutCSS. box { display:box; Display:-webkit-box; -webkit-box-align:center; Set the elements inside the vertical center -webkit-box-pack:center;//Set the horizontal center width:200px; height:30px; } . box. box_flex1{ box-flex:1; -webkit-box-flex:1; -moz-box-flex:1; Background:blue; } . box. box_flex2 { box-flex:2; -webkit-box-flex:2; -moz-box-flex:2; background:red; } . box. box_flex3 { box-flex:1; -webkit-box-flex:1; -moz-box-flex:1; Background:green; } HTML <ul class= "box" > <li class= "box_flex1" >1</li> <li class= "Box_flex2" >2< /li> <li class= "Box_flex3" >3</li></ul>
Adaptive Layout ModeIn order to adapt to different resolution of mobile phones, we do not recommend the width of writing dead. Instead, an adaptive layout is used. You can look at my blog post.
Http://www.cnblogs.com/xianyulaodi/p/5533201.html
A translucent gray matte appears when you disable the click link for an iOS userA,button,input,textarea {-webkit-tap-highlight-color: rgba (0,0,0,0;)}
Background-image and image loading differencesIn the process of Web page loading, the image background-image with CSS background image will wait until the structure loading is complete (after the contents of the Web page are all displayed) to start loading.
The HTML tag img is a part of the structure of the Web page will be loaded in the process of loading the structure, in other words, the page will first load the contents of the tag img, and then load the background image background-image,
If you introduce a large picture, the contents of the IMG will not be displayed until the image is downloaded. And if you use CSS to introduce the same image, the structure of the Web page and the content is loaded,
Before you start loading a background image, it doesn't affect the content of your browsing Web page.
Pseudo-element changes the default style of the number type input box{ background-color: transparent; } { -webkit-appearance: none;} { -webkit-appearance: none;}
Change the color value of placeholderInput::-webkit-input-placeholder{color: #AAAAAA;} Input:focus::-webkit-input-placeholder{color: #EEEEEE;}
Rotate events and styles:Refer to this article: http://www.cnblogs.com/xianyulaodi/p/5533185.html
Call and send text messages:Phone://Pay attention to the number, do not mess
<a href= "tel:110" > Call:110</a>
Texting:
<a href= "sms:110" > Texting: 110</a>
Transition splash ScreenIn Chrome and Safari, fixed possible page flicker when using CSS transforms or animations
The following code can fix this situation:
. cube { -webkit-backface-visibility:hidden; -moz-backface-visibility:hidden; -ms-backface-visibility:hidden; Backface-visibility:hidden; -webkit-perspective:1000; -moz-perspective:1000; -ms-perspective:1000; perspective:1000; /* Other Transform properties here * *}
In the browser of the WebKit kernel, the following methods are available
. Cube { -webkit-transform:translate3d (0, 0, 0); -moz-transform:translate3d (0, 0, 0); -ms-transform:translate3d (0, 0, 0); Transform:translate3d (0, 0, 0); /* Other Transform properties here * *}
Press and hold the page for a long time to flash backelement { -webkit-touch-callout:none;}
iOS keyboard letter input, default first letter capitalization<input type= "text" autocapitalize= "Off"/>
Mobile Endpoint Penetration problemThis question is more classic, a little summary
Scenario Reproduction:
<id= "Mask"> click Test </div>< href = "#" > Www.baidu.com </a >
Div is an absolutely positioned mask layer, and z-index is higher than a, a is a link, jump to Baidu. We're binding a tap event to the Div.
$ (' #mask '). On (' Tap ', function () { $ (' #mask '). Hide ();});
As we would expect, the mask layer div disappears. But when we click on the mask layer on the A tab, a link is triggered and jumps. Which is what we call a point-through event.
Reason for the occurrence:
Event Trigger Order: Touchstart >touchmove>touchend >click
That is, Touchstart is earlier than touchend earlier than click. Click on the mobile side has a 300ms delay, when we tap triggered after the mask layer is hidden, at this point the click has not triggered, 300ms after the mask layer is hidden, our click triggered to the following a link, thus a point through event.
Workaround:
(1) Use the touch event as much as possible to replace the Click event. For example, use the Touchend event (recommended).
(2) using Fastclick,https://github.com/ftlabs/fastclick
(3) block the click of a tag with preventdefault
(4) If not, replace the Click event
Use the Touchend event workaround as follows:
$ ("#mask"). On ("Touchend", function (e) { e.preventdefault ();});
Although many of the online summary, but this set of summary is suitable for my own. Convenient for you to check later
Not to be continued, updated continuously .....
If you think the article is useful, you can also give a small red packet to encourage encouragement, haha
Common knowledge Point notes for Web Mobile