Home > Web Front-end > CSS Tutorial > How to set the text zoom effect when clicked in css

How to set the text zoom effect when clicked in css

WBOY
Release: 2021-11-26 10:32:32
Original
5780 people have browsed it

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;}".

How to set the text zoom effect when clicked in css

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>
Copy after login

Output result:

How to set the text zoom effect when clicked in css

(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!

Related labels:
css
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