Home > Web Front-end > CSS Tutorial > A brief analysis of the little-known properties in CSS3: -webkit-tap-highlight-color

A brief analysis of the little-known properties in CSS3: -webkit-tap-highlight-color

高洛峰
Release: 2017-02-11 13:45:28
Original
3227 people have browsed it

The -webkit-tap-highlight-color attribute in CSS simply functions as the background color setting when clicked on the mobile phone. The following article mainly introduces this little-known attribute in CSS3: -webkit-tap -Highlight-color related information, friends in need can refer to it, let’s take a look below.

-webkit-tap-highlight-color

This property is only available on iOS (iPhone and iPad). When you click on a link or clickable element defined through 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).

detailed explanation of webkit-text-size-adjust in css3

1. When font-size< At 12px, 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, -webkit-text-size-adjust Using the body will cause the page zoom to fail

3. The body will inherit the style defined in the 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 the a tag is clicked on 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 The input behaves 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

More analysis of the little-known properties in CSS3:-webkit-tap-highlight For -color related articles, please pay attention to 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