CSS removes the background color of elements generated when they are clicked on the mobile terminal (recommended)

CSS removes the background color of elements generated when they are clicked on the mobile terminal (recommended)

Add the following code to the CSS style of the element that generates the background color when clicking:

-webkit-tap-highlight-color: transparent;

ps: Let's take a look at the css to cancel the background color of the a tag when it is clicked on the mobile terminal

1. Cancel the blue color of the a tag when it is clicked on the mobile terminal

-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
-webkit-user-select: none;
-moz-user-focus: none;
-moz-user-select: none;

2. When using an image as the click button of the a tag, there is often a gray background when touchstart is triggered

a,a:hover,a:active,a:visited,a:link,a:focus{
    -webkit-tap-highlight-color:rgba(0,0,0,0);
    -webkit-tap-highlight-color: transparent;
    outline:none;
    background: none;
    text-decoration: none;
}

3. Change the background color of the selected content

::selection { 
    background: #FFF; 
    color: #333; 
} 
::-moz-selection { 
    background: #FFF; 
    color: #333; 
} 
::-webkit-selection { 
    background: #FFF; 
    color: #333; 
}

4. Remove the gray background when clicking the ios input box

-webkit-tap-highlight-color:rgba(0,0,0,0);

Summarize

The above is the CSS that I introduced to you to remove the background color of elements when clicking on the mobile terminal. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  Specific use of the autoindex module in the Nginx Http module series

>>:  vue.js Router nested routes

Recommend

Common structural tags in XHTML

structure body, head, html, title text abbr, acro...

Detailed analysis of the blocking problem of js and css

Table of contents DOMContentLoaded and load What ...

Docker image compression and optimization operations

The reason why Docker is so popular nowadays is m...

Pure CSS3 realizes the effect of div entering and exiting in order

This article mainly introduces the effect of div ...

WeChat applet implements simple calculator function

WeChat applet: Simple calculator, for your refere...

Basic application methods of javascript embedded and external links

Table of contents Basic application of javascript...

Detailed tutorial on using VMware WorkStation with Docker for Windows

Table of contents 1. Introduction 2. Install Dock...

SVG button example code based on CSS animation

The specific code is as follows: <a href="...

JavaScript DOMContentLoaded event case study

DOMContentLoaded Event Literally, it fires after ...

How to implement the observer pattern in JavaScript

Table of contents Overview Application scenarios ...

MySQL Optimization: InnoDB Optimization

Study plans are easily interrupted and difficult ...

Vue component library ElementUI realizes the paging effect of table list

ElementUI implements the table list paging effect...