Tag: Height hid 1.0 off Port shielded hidden element comment
Click on the style flashing
Q: When you click on a link or a clickable element defined by JavaScript, it will appear with a translucent gray background.
A: The root cause is-webkit-tap-highlight-color, which is the color of the background box that is used to set the response when the element is triggered on a mobile device (such as adnroid, IOS). It is recommended to write in style initialization to avoid the problem: Div,input (selector) {-webkit-tap-highlight-color:rgba (0,0,0,0);} In addition, Blue border appears: Outline:none;
‘‘-webkit-tap-highlight-color : transparent ;
Block User Selection
Q: Prevent users from selecting text or pictures on the page
A: The code is as follows
-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;
How the mobile side clears the shadows in the input box
Q: On iOS, the input box defaults to an inner shadow, but cannot be cleared using Box-shadow, which can be turned off if no shadow is required:
A: The code is as follows
-webkit-appearance: none;
Suppress text scaling
Q: Suppress text scaling
A: The code is as follows
-webkit-text-size-adjust: 100%;
How to disable saving or copying images
Q: How to disable saving or copying images
A: The code is as follows
img{-webkit-touch-callout: none;}
Resolves an issue in which fonts appear jagged when the mobile side is scaled down
Q: Fixed a problem where fonts appear jagged after scaling down on the mobile side
A: The code is as follows
-webkit-font-smoothing: antialiased;
Set the size of the placeholder font in input
Q: Set the size of the placeholder font in input
A: The code is as follows
::-webkit-input-placeholder{ font-size:10pt;}
Audio elements and video elements do not play automatically in iOS and Andriod
Q:audio elements and video elements do not play automatically in iOS and Andriod
A: Code as follows, touch screen and play
$(‘html‘).one(‘touchstart‘,function(){audio.play()})
Mobile photos and uploading pictures
Q: Add different accept fields for file type
A: The code is as follows
type="file">的accept 属性<!-- 选择照片 --><input type=file accept="image/*"><!-- 选择视频 --><input type=file accept="video/*">
Input box Auto Fill color
Q: For input tag has been entered, will be for the content of the previous input to fill the yellow background, this is the WebKit kernel automatically added, the corresponding property is AutoComplete, the default is on, the other corresponding style is Input:-webkit-autofill and is non-changing.
A: The scheme is as follows 1 set the label autocomplete= "Off", the Pro test invalid May 2 set the inner shadow of the box as your normal color (white for example)
box-shadow:0 0 0 1000px #fff inset ; -webkit-box-shadow: 0 0 0px 1000px #fff inset;
Turn on hardware acceleration
Q: Optimize Rendering performance
A: The code is as follows
-webkit-transform: translate3d(0, 0, 0);-moz-transform: translate3d(0, 0, 0);-ms-transform: translate3d(0, 0, 0);transform: translate3d(0, 0, 0);
User set font size to zoom in or out causes page layout errors
body { -webkit-text-size-adjust: 100% !important; text-size-adjust: 100% !important; -moz-text-size-adjust: 100% !important;
Remove the arrow with type number on the mobile side
input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{ -webkit-appearance: none !important; margin: 0; }
Realization of horizontal screen vertical screen scheme
-
CSS with CSS3 media query, disadvantage is the width and height of bad control
@media screen and (orientation: portrait) { .main { -webkit-transform:rotate(-90deg); -moz-transform: rotate(-90deg); -ms-transform: rotate(-90deg); transform: rotate(-90deg); width: 100vh; height: 100vh; /*去掉overflow 显示正常,但是浏览器有问题,竖屏时强制横屏缩小*/ overflow: hidden; }}@media screen and (orientation: landscape) { .main { -webkit-transform:rotate(0); -moz-transform: rotate(0); -ms-transform: rotate(0); transform: rotate(0) }}
-
JS to determine the direction of the screen or resize event
var evt ="Onorientationchange"In Window?"Orientationchange":"Resize"; Window.addeventlistener (EVT,function () {var width = document.documentElement.clientWidth; var height = document.documentElement.clientHeight;$print = $ (' #print ');if (width > height) {$print. Width (width);$print. Height (height);$print. CSS (' Top ', 0);$print. CSS (' Left ', 0); $print. css ( ' transform ', ' none ') ; $print. css ( ' Transform-origin ', ' 50% 50% '); } else{ $print. width (height); $print. Height (width); $print. css ( ' top ', (height-width)/2); $print. css ( ' left ', 0-(height-width)/2); $print. css ( ' transform ', ' rotate (90deg) '); Span class= "hljs-variable" > $print. css ( ' Transform-origin ', 50% 50% '); }}, false);
Robinsonzhang
Links: Https://juejin.im/post/5af918636fb9a07ac5603ecb
Source: Denver Nuggets
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Mobile side common Bug Rollup 001