How to use the webkit-tap-highlight-color property of CSS3

php中世界最好的语言
Release: 2018-03-22 13:16:39
Original
2812 people have browsed it

This time I will show you how to use the webkit-tap-highlight-color attribute of CSS3, and what are the precautions for using CSS3's webkit-tap-highlight-color. The following is a practical case. Get up and take a look.

-webkit-tap-highlight-color

This property is only used on iOS (iPhone and iPad). When you click on a link or clickable element defined via

Javascript, it will appear with a semi-transparent gray background. To reset this behavior, you can set -webkit-tap-highlight-color to any color. To disable this highlighting, set the color's alpha value to 0.

Example: Set the highlight color to 50% transparent red:

-webkit-tap-highlight-color: rgba(255,0,0,0.5);
Copy after login
Browser support: iOS only (iPhone and iPad).

css3-webkit -text-size-adjust detailed explanation

1. When

font-size<12px in the style sheet, the font display in the Chinese version of chrome browser is still 12px. At this time You can use html{-webkit-text-size-adjust:none;}

2. Putting -webkit-text-size-adjust on the body will cause the page zoom to fail

3.body Will inherit the style defined in html

4. Use -webkit-text-size-adjust and do not define it as inheritable or global

outline: none

(1) The purpose of defining this style for the a tag on the PC side is to cancel the dotted line that appears when clicking the a tag in the

ie browser. IE7 and below browsers do not recognize this attribute yet. You need to add hidefocus="true"

(2)input on the a tag, textarea{outline:none} to cancel the default text box focus style under chrome

(3) does not work on the mobile terminal. If you want to remove the default style of the text box, you can use -webkit-

appearance. To cancel the default style when focusing, use -webkit-tap-highlight. -color.

I have seen some mobile reset files adding this attribute, but it is actually redundant.

webkit-appearance

-webkit-appearance: none;   //消除输入框和按钮的原生外观,在iOS上加上这个属性才能给按钮和输入框自定义样式 。
Copy after login

Note: Different types of input behave differently after using this attribute. Text and button have no style, radio and checkbox disappear directly

-webkit-user-select

-webkit-user-select: none; // 禁止页面文字选择 ,此属性不继承,一般加在body上规定整个body的文字都不会自动调整
Copy after login

-webkit-touch-callout

-webkit-touch-callout:none;  // 禁用长按页面时的弹出菜单(iOS下有效) ,img和a标签都要加
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Four hiding methods in html+css
Common misunderstandings in the use of CSS and HTML

Detailed explanation of the use of border-image in css style

The above is the detailed content of How to use the webkit-tap-highlight-color property of CSS3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template