Home > Article > Web Front-end > How to set the text zoom effect when clicked in css
In css, you can use the ":active" selector and the "font-size" attribute to set the zoom effect when the text is clicked. The syntax is "picture element: active{font-size: zoom ratio value;}".
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
How to set the text enlargement and reduction effect in css when clicked
In css, you can use the ":active" selector and font-size attribute to Set the enlargement and reduction effect of the cornerstone text size. The :active" selector is used to set the style when the mouse clicks on the element. The font-size attribute is used to set the font size.
Let's take an example to see how to implement click text. The effect of zooming in and out, the example is as follows:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>css设置鼠标点击字体变大缩小</title> <style type="text/css"> .font-big:active{ font-size:200%; } .font-small:active{ font-size:50%; } </style> </head> <body> <div class="font-big"> 鼠标点击放大 </div> <div class="font-small"> 鼠标点击缩小 </div> </body> </html>
Output result:
(Learning video sharing: css video tutorial)
The above is the detailed content of How to set the text zoom effect when clicked in css. For more information, please follow other related articles on the PHP Chinese website!