Effect The effect diagram is as follows Implementation ideas
DOM structure Use two nested div containers. The parent container controls the position of the icon display, and the child container is used to write the style of the sun's light and shadow rectangle. <div class="container"> <div class="sunny"></div> </div> CSS Styles 1. Define the parent container style, control the icon position, and add a background color to the entire page for easy preview body{ background: rgba(73, 74, 95, 1); } .container{ width: 170px; height: 170px; position: relative; margin: 250px auto; } 2. Light and shadow rectangular style, with a 360° rotating animation .sunny{ width: 20px; height: 140px; position: absolute; top: 20px; left: 90px; background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%); animation: sunny 15s linear infinite; } @keyframes sunny { 0%{ transform: rotate(0deg); } 100%{ transform: rotate(360deg); } } 3. Write another vertical light and shadow rectangle .sunny::before{ content: ''; width: 20px; height: 140px; position: absolute; bottom: 0; left: 0; background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%); transform: rotate(90deg) } 4. The style of the sun circle .sunny::after{ content: ''; width: 80px; height: 80px; position: absolute; top: 30px; left: -30px; background: #ffee44; border-radius: 50%; box-shadow: rgba(255,255,0,0.2) 0 0 0 15px; } The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: td width problem when td cells are merged
>>: Why Google and Facebook don't use Docker
Table of contents 1. Overview 2. Attributes 1. Ma...
1. Methods for implementing components:組件名稱首字母必須大...
This article example shares the specific code of ...
Table of contents Proxy forwarding rules The firs...
Table of contents 1. What to debug 2. Features of...
Preface The master-slave replication relationship...
This article uses an example to describe the MySQ...
I would like to quote an article by Zhang Xinxu a...
This article describes the import and export oper...
This article example shares the specific code for...
Table of contents Preface 1. Rendering 2. Code 3....
Table of contents 1. Background of the problem: 2...
1. Use the <nobr> tag to achieve no line bre...
The author of this article @子木yoyo posted it on hi...
Use regular expressions to determine the IE browse...