当前位置:网站首页>Simple HelloWorld color change
Simple HelloWorld color change
2022-07-05 05:02:00 【Fierce chicken】
The basic function of this web effect is that clicking the button on the left will change color , Click the button on the right to restore the color
Add some special effects on the basis of this simple function , For practice CSS. The special effects added are :
When the mouse hovers over the button, the button border will move
The realization of button effect needs the help of button Two pseudo elements::before
and::after
, as well as pseudo-classes:hover
There are also transition stylestransition
;
When the mouse hovers over the button , Two above and below the border “ Gap ” Will move in opposite directions , It's actually two with the same color as the background Pseudo element oblique square (transform: skew(-50deg)
) It's moving , This has the effect of changing the borderWhen the color changes from the original color to the target color , The circle mask expands from the middle to both sides ; When the color changes back to the original color , The circle mask retracts from both sides to the middle
The implementation here requires With the help ofclip-path
andtransition
;
In fact, the black font shown in the figure below “Hello World!” There is an absolutely positioned red on the upper layer of “Hello World!”, Just at the beginningclip-path: circle(0px)
Generate a display part as radius0px
The circular mask space is hidden . When you click “ Turn red ” After button , This circular mask shows that the space changes to a radius200px
, The display space is large enough , Red “Hello World! It will be completely displayed ”. In transition propertiestransition
The red font will slowly display under the action of[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-YO9K3qzU-1644677773265)(img/circleClipPath.png “ Schematic diagram of circular mask ”)]
effect
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-DRaqYgCK-1644677773266)(img/finalEffect.gif “ Final effect ”)]
Demo link
Article source :https://gitee.com/thisismyaddress/bocheng-blogs/tree/master/ Web page effects / ordinary HelloWorld Color change
边栏推荐
猜你喜欢
AutoCAD - workspace settings
【论文笔记】Multi-Goal Reinforcement Learning: Challenging Robotics Environments and Request for Research
PostgreSQL surpasses mysql, and the salary of "the best programming language in the world" is low
AutoCAD - feature matching
Download and use of font icons
Unity find the coordinates of a point on the circle
2021 higher education social cup mathematical modeling national tournament ABCD questions - problem solving ideas - Mathematical Modeling
Manually implement heap sorting -838 Heap sort
2022 American College Students' mathematical modeling ABCDEF problem thinking /2022 American match ABCDEF problem analysis
質量體系建設之路的分分合合
随机推荐
Sixth note
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)
Solutions and answers for the 2021 Shenzhen cup
XSS injection
用 Jmeter 工具做个小型压力测试
On-off and on-off of quality system construction
C4D simple cloth (version above R21)
775 Div.1 B. integral array mathematics
669. 修剪二叉搜索树 ●●
2022/7/1 learning summary
2022/7/1學習總結
mysql审计日志归档
Unity intelligent NPC production -- pre judgment walking (method 1)
Cocos progress bar progresstimer
stm32Cubemx(8):RTC和RTC唤醒中断
PostgreSQL 超越 MySQL,“世界上最好的编程语言”薪水偏低
Kali 2018 full image download
AutoCAD - graphic input and output
2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem
2021 electrician cup (the 12th "China Society of electrical engineering Cup" National Undergraduate electrician mathematical modeling) detailed ideas + codes + references