<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>CSS on Zhou&#39;s blog</title>
        <link>https://blog.zhoujump.com/en/tags/css/</link>
        <description>Recent content in CSS on Zhou&#39;s blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <lastBuildDate>Sun, 14 Sep 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.zhoujump.com/en/tags/css/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>A CSS-Only Scroll-Driven Animation Effect</title>
        <link>https://blog.zhoujump.com/en/p/animation-timeline/</link>
        <pubDate>Sun, 14 Sep 2025 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/animation-timeline/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/en/p/animation-timeline/cover.en.webp" alt="Featured image of post A CSS-Only Scroll-Driven Animation Effect" /&gt;&lt;blockquote&gt;
&lt;p&gt;This article is published on my personal website, original link: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/p/animation-timeline/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;A CSS-Only Scroll-Driven Animation Effect&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;first-lets-look-at-this-simple-example&#34;&gt;First, let&amp;rsquo;s look at this simple example
&lt;/h2&gt;&lt;h3 id=&#34;code&#34;&gt;Code:
&lt;/h3&gt;&lt;p&gt;You can also scroll down to see the effect directly.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;23
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;24
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;25
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;26
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;27
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;28
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;29
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;30
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;31
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;32
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;33
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;34
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;35
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;36
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;37
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;38
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;39
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;40
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;41
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;42
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;43
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;44
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;45
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;46
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;47
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;48
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;49
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;50
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;div&lt;/span&gt; &lt;span class=&#34;na&#34;&gt;class&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;out-cont&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;c&#34;&gt;&amp;lt;!-- The outermost element, used to define the fixed distance of the element --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;div&lt;/span&gt; &lt;span class=&#34;na&#34;&gt;class&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;inner-cont&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;c&#34;&gt;&amp;lt;!-- Inner element, used to fix the position of the element --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;div&lt;/span&gt; &lt;span class=&#34;na&#34;&gt;class&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;animation-item&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;c&#34;&gt;&amp;lt;!-- The content of the element that plays the animation --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;div&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;div&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;div&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;style&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nc&#34;&gt;out-cont&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;/* The outermost element, used to define the fixed distance of the element, which means the element will be fixed for two screen heights */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;width&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;%&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;height&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;200&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;vh&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;position&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;relative&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nc&#34;&gt;inner-cont&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;/* Inner element, used to fix the position of the element, using sticky to fix the element within the range */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;width&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;%&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;height&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;50&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;vh&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;position&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;sticky&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;top&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;25&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;vh&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;display&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;flex&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;align-items&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;center&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;justify-content&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;center&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nc&#34;&gt;animation-item&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;/* The content of the element that plays the animation, using animation-timeline to achieve scroll-driven animation */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;width&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;20&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;%&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;aspect-ratio&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;background-color&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mh&#34;&gt;#2E74B5&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;animation&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;move&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;s&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;linear&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;forwards&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;animation-timeline&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;view&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;animation-range&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;contain&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;@&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;keyframes&lt;/span&gt; &lt;span class=&#34;nt&#34;&gt;move&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;%&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;transform&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;rotate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;deg&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;border-radius&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;8&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;%&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;50&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;%&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;transform&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;rotate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;360&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;deg&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;border-radius&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;50&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;%&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nt&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;%&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;border-radius&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;8&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;%&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;transform&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;rotate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;720&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;deg&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;style&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h3 id=&#34;effect&#34;&gt;Effect:
&lt;/h3&gt;&lt;div class=&#34;out-cont&#34;&gt;
    &lt;div class=&#34;inner-cont&#34;&gt;
        &lt;div class=&#34;animation-item&#34;&gt;&lt;/div&gt;
        &lt;div class=&#34;animation-view&#34;&gt;
            &lt;div class=&#34;animation-view-out&#34;&gt;
                .out-cont
                &lt;div class=&#34;animation-view-inner&#34;&gt;
                    .inner-cont
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&#34;animation-view-screen&#34;&gt;
                Viewport
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;sticky-sticky-layout&#34;&gt;sticky: Sticky Layout
&lt;/h2&gt;&lt;p&gt;For front-end developers, this is not unfamiliar, so I&amp;rsquo;ll just briefly introduce it:
position: sticky is a layout method between position:relative and position:fixed. When the parent element appears on the screen, it behaves like fixed, fixing itself on the screen. When the parent element goes out of the screen, it behaves like relative, following the normal document flow layout, being taken away by the parent container.
Regarding how this case uses sticky to achieve similar element fixing effects, there is a simple demonstration on the right side of the effect example above, which can help with understanding. And this demonstration is also pure CSS.&lt;/p&gt;</description>
        </item>
        <item>
        <title>Pure CSS to achieve the marquee effect</title>
        <link>https://blog.zhoujump.com/en/p/css-marquee/</link>
        <pubDate>Thu, 20 Feb 2025 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/css-marquee/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/en/p/css-marquee/cover.en.webp" alt="Featured image of post Pure CSS to achieve the marquee effect" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/css-marquee/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Pure CSS to achieve the marquee effect&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;see-the-effect-first&#34;&gt;See the effect first
&lt;/h2&gt;&lt;div class=&#34;marquee&#34;&gt;
&lt;span&gt;I am a personal intern who has been practicing marketing for two and a half years. I like html, css, and js. &lt;/span&gt;
&lt;span&gt;I am a personal intern who has been practicing marketing for two and a half years. I like html, css, and js. &lt;/span&gt;
&lt;/div&gt;
&lt;style&gt;
.marquee {
overflow: hidden;
white-space: nowrap;
width: 400px;
display: flex;
}
.marquee span {
animation: marquee 10s linear infinite;
}
@keyframes marquee {
100% {transform: translateX(-100%);}
}
&lt;/style&gt;
&lt;h2 id=&#34;marquee-tag&#34;&gt;&lt;code&gt;&amp;lt;marquee&amp;gt;&lt;/code&gt; tag
&lt;/h2&gt;&lt;p&gt;At this time, some front-end bosses will stand up and say, isn&amp;rsquo;t this just a matter of &lt;code&gt;&amp;lt;marquee&amp;gt;&lt;/code&gt; tag?
However, this element has been abandoned. Although it can still be used, it may be removed by mainstream browsers one day. It is better to use it less
&lt;img src=&#34;https://blog.zhoujump.com/p/css-marquee/1-1-en.webp&#34;
	width=&#34;809&#34;
	height=&#34;370&#34;
	
	loading=&#34;lazy&#34;
	
		alt=&#34;The marquee has been removed&#34;
	
	
		class=&#34;gallery-image&#34; 
		data-flex-grow=&#34;218&#34;
		data-flex-basis=&#34;524px&#34;
	
&gt;&lt;/p&gt;</description>
        </item>
        <item>
        <title>Pure CSS to implement circular progress bar</title>
        <link>https://blog.zhoujump.com/en/p/circular-progression/</link>
        <pubDate>Sun, 15 Dec 2024 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/circular-progression/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/en/p/circular-progression/cover.en.webp" alt="Featured image of post Pure CSS to implement circular progress bar" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/circular-progression/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Pure CSS to implement circular progress bar&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;see-the-effect-first&#34;&gt;See the effect first
&lt;/h2&gt;&lt;p&gt;This circular progress bar is made with pure CSS and uses CSS variables to control the progress. You can open the developer tool, select it and change its inline CSS variable &lt;code&gt;--progress: 60&lt;/code&gt;, and both the progress and content will change.&lt;/p&gt;
&lt;div class=&#34;demo-process&#34; style=&#34;--progress: 60&#34;&gt; &lt;div class=&#34;demo-process-inner&#34;&gt;&lt;/div&gt; &lt;/div&gt; &lt;style&gt; style[contenteditable]{ display: block; outline: none; } .demo-process{ margin: auto; position: relative; width: 200px; height: 200px; border-radius: 50%; padding: 16px; background: #99e6ff; background: conic-gradient( #99e6ff 0%, #99e6ff calc(var(--progress) * 1%), transparent 0%); } .demo-process::after{ content: &#39;&#39;; position: absolute; left: calc(50% - 10px); top: calc(50% - 10px); width: 16px; height: 16px; border-radius: 50%; transform: rotate(calc(3.6deg * var(--progress))) translateY(-92px); background: white; background: var(--card-background); border: 4px solid #99e6ff;; } .demo-process::before{ content: &#39;&#39;; position: absolute; left: calc(50% - 8px); top: 0; width: 16px; height: 16px; border-radius: 50%; background: #99e6ff; } .demo-process-inner{ width: 100%; height: 100%; border-radius: 50%; background: white; display: flex; justify-content: center; align-items: center; background: var(--card-background);
}
.demo-process-inner::before{
counter-reset: process var(--progress);
content: counter(process)&#39;%&#39;;
font-size: 30px;
color: #99e6ff;
}
&lt;/style&gt;
&lt;h2 id=&#34;css-variables&#34;&gt;CSS variables
&lt;/h2&gt;&lt;p&gt;CSS variables are a new feature introduced in CSS3, which allows you to define a variable. You can define a CSS variable through &lt;code&gt;--variable name&lt;/code&gt; and use it through &lt;code&gt;var(--variable name)&lt;/code&gt;.
The following small demo shows how to use CSS variables. You can open the developer tools and play with it.&lt;/p&gt;</description>
        </item>
        <item>
        <title>Pure CSS to achieve a cool input box effect</title>
        <link>https://blog.zhoujump.com/en/p/valid_input/</link>
        <pubDate>Tue, 22 Oct 2024 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/valid_input/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/en/p/valid_input/cover.en.webp" alt="Featured image of post Pure CSS to achieve a cool input box effect" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/valid-input/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Pure CSS to achieve a cool input box effect&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;see-the-effect-first&#34;&gt;See the effect first
&lt;/h2&gt;&lt;div class=&#34;demo-input&#34;&gt;
&lt;input required/&gt;
&lt;label&gt;username&lt;/label&gt;
&lt;/div&gt;
&lt;style&gt;
.demo-input{
position: relative;
height: 40px;
width: 300px;
margin: 8px;
}
.demo-input *{transition-duration: 100ms}
.demo-input input{
width: 100%;
height: 100%;
box-sizing: border-box; border: 2px solid gray; border-radius: 6px; outline: none; padding-left: 10px; font-size: 20px; color: #006080; } .demo-input input:valid, .demo-input input:focus {border: 2px solid #006080} .demo-input label{ position: absolute; top:0; left: 10px; font-size: 20px; color: gray; line-height: 36px; pointer-events: none; } .demo-input input:valid + label, .demo-input input:focus + label { color: #006080; top:-12px; font-size: 18px; padding: 0 4px; background-color: white;
line-height: 18px;
}
&lt;/style&gt;
&lt;h2 id=&#34;valid-and-invalid-pseudo-classes&#34;&gt;&lt;code&gt;:valid&lt;/code&gt; and &lt;code&gt;:invalid&lt;/code&gt; pseudo-classes
&lt;/h2&gt;&lt;p&gt;These two pseudo-classes can be used on &lt;code&gt;input&lt;/code&gt; and &lt;code&gt;select&lt;/code&gt; elements to select input boxes that have passed or failed validation. Let&amp;rsquo;s learn about them through the following simple example:
This input box will check whether the input is an email address, otherwise the background color will be red warning.&lt;/p&gt;</description>
        </item>
        <item>
        <title>Cleverly use attribute selectors to implement filters in pure CSS</title>
        <link>https://blog.zhoujump.com/en/p/checkbox-filter/</link>
        <pubDate>Fri, 18 Oct 2024 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/checkbox-filter/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/en/p/checkbox-filter/cover.en.webp" alt="Featured image of post Cleverly use attribute selectors to implement filters in pure CSS" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/checkbox-filter/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Cleverly use attribute selectors to implement filters in pure CSS&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;take-a-look-at-the-effect-of-this-example-first&#34;&gt;Take a look at the effect of this example first
&lt;/h2&gt;&lt;div class=&#34;filter&#34;&gt;
&lt;input checked type=&#34;radio&#34; name=&#34;filter&#34; id=&#34;all&#34;/&gt;
&lt;label for=&#34;all&#34;&gt;All&lt;/label&gt;
&lt;input type=&#34;radio&#34; name=&#34;filter&#34; id=&#34;yellow&#34;/&gt;
&lt;label for=&#34;yellow&#34;&gt;Yellow&lt;/label&gt;
&lt;input type=&#34;radio&#34; name=&#34;filter&#34; id=&#34;red&#34;/&gt;
&lt;label for=&#34;red&#34;&gt;Red&lt;/label&gt;
&lt;input type=&#34;radio&#34; name=&#34;filter&#34; id=&#34;green&#34;/&gt;
&lt;label for=&#34;green&#34;&gt;green&lt;/label&gt; &lt;input type=&#34;radio&#34; name=&#34;filter&#34; id=&#34;purple&#34;/&gt; &lt;label for=&#34;purple&#34;&gt;Purple&lt;/label&gt; &lt;/div&gt; &lt;div class=&#34;fruit-cont&#34;&gt; &lt;div c=&#34;r&#34;&gt;🍉&lt;/div&gt;&lt;div c=&#34;y&#34;&gt;🍊&lt;/div&gt;&lt;div c=&#34;g&#34;&gt;🍈&lt;/div&gt; &lt;div c=&#34;p&#34;&gt;🍇&lt;/div&gt;&lt;div c=&#34;g&#34;&gt;🥝&lt;/div&gt;&lt;div c=&#34;y&#34;&gt;🍋&lt;/div&gt; &lt;div c=&#34;y&#34;&gt;‍🍌&lt;/div&gt;&lt;div c=&#34;y&#34;&gt;🍍&lt;/div&gt;&lt;div c=&#34;y&#34;&gt;🥭&lt;/div&gt; &lt;div c=&#34;r&#34;&gt;🍎&lt;/div&gt;&lt;div c=&#34;g&#34;&gt;🍏&lt;/div&gt;&lt;div c=&#34;g&#34;&gt;🍐&lt;/div&gt; &lt;div c=&#34;r&#34;&gt;🍑&lt;/div&gt;&lt;div c=&#34;r&#34;&gt;🍒&lt;/div&gt;&lt;div c=&#34;r&#34;&gt;🍓&lt;/div&gt; &lt;div c=&#34;p&#34;&gt;🫐&lt;/div&gt;&lt;div c=&#34;r&#34;&gt;‍🍅&lt;/div&gt;&lt;div c=&#34;g&#34;&gt;🫒&lt;/div&gt; &lt;/div&gt; &lt;style&gt; .filter{display: flex;cursor: pointer;user-select: none;} .filter label{ width: calc(25% - 12px); box-sizing: border-box; margin: 6px; height: 40px; line-height: 36px; text-align: center; border-radius: 8px; border: 2px solid; } .filter input{display: none;} .fruit-cont{display: flex;flex-wrap: wrap;} .fruit-cont div{ display: none; width: calc(25% - 12px); box-sizing: border-box; margin: 6px; height: 60px; line-height: 60px; text-align: center; font-size: 30px; text-shadow: 0 0 6px white; border-radius: 8px; } .filter:has(&gt;#yellow:checked) ~ .fruit-cont div[c=&#34;y&#34;]{display: block} .filter:has(&gt;#green:checked) ~ .fruit-cont div[c=&#34;g&#34;]{display: block} .filter:has(&gt;#red:checked) ~ .fruit-cont div[c=&#34;r&#34;]{display: block} .filter:has(&gt;#purple:checked) ~ .fruit-cont div[c=&#34;p&#34;]{display: block} .filter:has(&gt;#all:checked) ~ .fruit-cont div{display: block} .fruit-cont div[c=&#34;r&#34;]{background-color: #e74c3c} .fruit-cont div[c=&#34;g&#34;]{background-color: #2ecc71} .fruit-cont div[c=&#34;p&#34;]{background-color: #9b59b6} .fruit-cont div[c=&#34;y&#34;]{background-color: #f39c12 } .filter label[for=&#34;red&#34;]{border-color: #e74c3c;color: #e74c3c;} .filter label[for=&#34;green&#34;]{border-color: #2ecc71;color: #2ecc71;} .filter label[for=&#34;purple&#34;]{border-color: #9b59b6;color: #9b59b6;} .filter label[for=&#34;yellow&#34;]{border-color: #f39c12 ;color: #f39c12 ;}
.filter label[for=&#34;all&#34;]{border-color: black;color: black ;}
.filter input:checked + label[for=&#34;red&#34;]{background-color: #e74c3c;color: white;}
.filter input:checked + label[for=&#34;green&#34;]{background-color: #2ecc71;color: white;}
.filter input:checked + label[for=&#34;purple&#34;]{background-color: #9b59b6;color: white;}
.filter input:checked + label[for=&#34;yellow&#34;]{background-color: #f39c12 ;color: white;}
.filter input:checked + label[for=&#34;all&#34;]{background-color: black ;color: white;}
&lt;/style&gt;
&lt;h2 id=&#34;has-pseudo-class-and-attribute-selector&#34;&gt;&lt;code&gt;:has()&lt;/code&gt; pseudo-class and attribute selector
&lt;/h2&gt;&lt;p&gt;Let&amp;rsquo;s learn about these two selectors through the following small example&lt;/p&gt;</description>
        </item>
        <item>
        <title>Pure CSS to implement the edit and save buttons of the input box</title>
        <link>https://blog.zhoujump.com/en/p/checked_input/</link>
        <pubDate>Sun, 29 Sep 2024 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/checked_input/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/p/checked_input/cover.webp" alt="Featured image of post Pure CSS to implement the edit and save buttons of the input box" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/checked_input/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Pure CSS to implement the edit and save buttons of the input box&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;see-the-effect-first&#34;&gt;See the effect first
&lt;/h2&gt;&lt;p&gt;Click the &lt;code&gt;Edit&lt;/code&gt; on the right to activate the input on the left, and click the &lt;code&gt;Finish&lt;/code&gt; on the right to save the input box content&lt;/p&gt;
&lt;div class=&#34;s-box&#34;&gt;
&lt;input id=&#34;s-edit&#34; type=&#34;checkbox&#34;/&gt;
&lt;input class=&#34;s-input&#34; value=&#34;Click the &#39;Edit&#39; button on the right→&#34;/&gt;
&lt;label class=&#34;s-label&#34; for=&#34;s-edit&#34;&gt;&lt;/label&gt;
&lt;/div&gt;
&lt;style&gt;
.s-box {
background: #fff;
border: 1px solid #ddd;
border-radius: 12px;
padding: 10px; transition: all .3s; } .s-box:hover{ box-shadow: 0 0 10px #ddd; transition: all .3s; } .s-input,.s-input:focus{ width:calc(100% - 60px); font-size: 16px; padding: 4px; outline: none; border: none; pointer-events: none; border: 1px solid #fff; transition: all .3s; } .s-label{ width: 40px; cursor: pointer; float: right; text-align: center; } #s-edit:checked ~ .s-input{ pointer-events: auto; border: 1px solid #ddd; border-radius: 4px; transition: all .3s; } #s-edit{display: none;}
.s-label::after{content:&#34;编辑&#34;;}
#s-edit:checked ~ .s-label::after{content:&#34;完成&#34;;}
&lt;/style&gt;
&lt;h2 id=&#34;pointer-events&#34;&gt;pointer-events
&lt;/h2&gt;&lt;p&gt;We all know that the disabled attribute in &lt;code&gt;&amp;lt;input disabled=&amp;quot;true&amp;quot;/&amp;gt;&lt;/code&gt; can be used to make the input box uneditable, but as an element attribute, it needs to be modified using js. So how do we achieve this in a pure CSS environment?
The answer is to use the &lt;code&gt;pointer-events&lt;/code&gt; attribute, which is used to define how an element responds to user clicks. For example, the following two examples:&lt;/p&gt;</description>
        </item>
        <item>
        <title>Pure CSS to achieve the effect of circular flipping</title>
        <link>https://blog.zhoujump.com/en/p/index-checked/</link>
        <pubDate>Fri, 27 Sep 2024 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/index-checked/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/p/index-checked/cover.webp" alt="Featured image of post Pure CSS to achieve the effect of circular flipping" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/index-checked/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Pure CSS to achieve the effect of circular flipping&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;see-the-effect-first&#34;&gt;See the effect first
&lt;/h2&gt;&lt;p&gt;Click on the card to switch one, and the entire implementation process does not use js. In addition to the two cards, this sample actually has two transparent &lt;code&gt;input&lt;/code&gt;s. You actually click on these two &lt;code&gt;input&lt;/code&gt;s, and these two &lt;code&gt;input&lt;/code&gt;s will modify their own &lt;code&gt;z-index&lt;/code&gt; properties after clicking, ensuring that you will definitely click on another one next time you click.&lt;/p&gt;</description>
        </item>
        <item>
        <title>Pure CSS Rating Component</title>
        <link>https://blog.zhoujump.com/en/p/input-star/</link>
        <pubDate>Wed, 25 Sep 2024 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/input-star/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/p/input-star/cover.webp" alt="Featured image of post Pure CSS Rating Component" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/input-star/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Pure CSS Rating Component&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;see-the-effect-first&#34;&gt;See the effect first
&lt;/h2&gt;&lt;p&gt;The following is a rating component implemented purely by CSS. Click on the star to rate. Different ratings will display different colors.&lt;/p&gt;
&lt;div class=&#34;cont&#34;&gt; &lt;input class=&#34;radio&#34; name=&#34;star&#34; id=&#34;star1&#34; type=&#34;radio&#34;&gt; &lt;input class=&#34;radio&#34; name=&#34;star&#34; id=&#34;star2&#34; type=&#34;radio&#34;&gt; &lt;input class=&#34;radio&#34; name=&#34;star&#34; id=&#34;star3&#34; type=&#34;radio&#34;&gt; &lt;input class=&#34;radio&#34; name=&#34;star&#34; id=&#34;star4&#34; type=&#34;radio&#34;&gt; &lt;input class=&#34;radio&#34; name=&#34;star&#34; id=&#34;star5&#34; type=&#34;radio&#34;&gt; &lt;label class=&#34;label&#34; for=&#34;star1&#34;&gt;★&lt;/label&gt; &lt;label class=&#34;label&#34; for=&#34;star2&#34;&gt;★&lt;/label&gt; &lt;label class=&#34;label&#34; for=&#34;star3&#34;&gt;★&lt;/label&gt; &lt;label class=&#34;label&#34; for=&#34;star4&#34;&gt;★&lt;/label&gt; &lt;label class=&#34;label&#34; for=&#34;star5&#34;&gt;★&lt;/label&gt; &lt;/div&gt; &lt;style&gt; .cont{ position: relative; display: flex; } .radio{ display: none; } .label{ color: #ccc; transition-duration:.3s; font-size: 24px; scale:.9; } #star1:checked ~ .label:nth-child(6), #star2:checked ~ .label:nth-child(-n+7) { color:#515A5A; transition-duration:.3s; scale: 1; } #star3:checked ~ .label:nth-child(-n+8), #star4:checked ~ .label:nth-child(-n+9){ color:#3498db; transition-duration:.3s; scale: 1; } #star5:checked ~ .label{ color:#f1c40f; transition-duration:.3s; scale: 1; }
&lt;/style&gt;
&lt;p&gt;This component is an upgraded version of the article &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/p/checked-css/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Realize option selection effect without using js&lt;/a&gt;. Some prerequisite knowledge is mentioned in it. Students who are interested can read this article first.&lt;/p&gt;</description>
        </item>
        <item>
        <title>Pure CSS to achieve option selection effect</title>
        <link>https://blog.zhoujump.com/en/p/checked-css/</link>
        <pubDate>Wed, 25 Sep 2024 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/checked-css/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/p/checked-css/cover.webp" alt="Featured image of post Pure CSS to achieve option selection effect" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/checked-css/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Pure CSS to achieve option selection effect&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;see-the-effect-first&#34;&gt;See the effect first
&lt;/h2&gt;&lt;p&gt;You can switch different options by clicking, and this example does not use js but is completely implemented with css.&lt;/p&gt;
&lt;div class=&#34;cont&#34;&gt; &lt;input class=&#34;input&#34; checked type=&#34;radio&#34; id=&#34;radio1&#34; name=&#34;radio&#34;/&gt; &lt;label class=&#34;label&#34; for=&#34;radio1&#34;&gt;Option 1&lt;/label&gt; &lt;input class=&#34;input&#34; type=&#34;radio&#34; id=&#34;radio2&#34; name=&#34;radio&#34;/&gt; &lt;label class=&#34;label&#34; for=&#34;radio2&#34;&gt;Option 2&lt;/label&gt; &lt;input class=&#34;input&#34; type=&#34;radio&#34; id=&#34;radio3&#34; name=&#34;radio&#34;/&gt; &lt;label class=&#34;label&#34; for=&#34;radio3&#34;&gt;Option 3&lt;/label&gt; &lt;input class=&#34;input&#34; type=&#34;radio&#34; id=&#34;radio4&#34; name=&#34;radio&#34;/&gt; &lt;label class=&#34;label&#34; for=&#34;radio4&#34;&gt;Option 4&lt;/label&gt; &lt;/div&gt; &lt;style&gt; .cont{ display: flex; line-height: 120px; text-align: center; } .label{ margin-right: 10px; width: 60px;
height: 120px;
background: #ccc;
border-radius: 10px;
transition-duration:.3s;
}
.input{
display: none;
}
.input:checked + .label{
transition-duration:.3s;
width: 120px;
background:#99e6ff;
color:#006080;
}
&lt;/style&gt;
&lt;h2 id=&#34;checked-pseudo-class-selector&#34;&gt;:checked pseudo-class selector
&lt;/h2&gt;&lt;p&gt;The core of this effect is the :checked pseudo-class selector. This selector can match the element clicked by the user, which means that we can set the style for the element selected by the user separately.&lt;/p&gt;</description>
        </item>
        <item>
        <title>Add transition animation for elements with uncertain height</title>
        <link>https://blog.zhoujump.com/en/p/grid-transition/</link>
        <pubDate>Tue, 24 Sep 2024 00:00:00 +0000</pubDate>
        
        <guid>https://blog.zhoujump.com/en/p/grid-transition/</guid>
        <description>&lt;img src="https://blog.zhoujump.com/p/grid-transition/cover.webp" alt="Featured image of post Add transition animation for elements with uncertain height" /&gt;&lt;blockquote&gt;
&lt;p&gt;Original article: &lt;a class=&#34;link&#34; href=&#34;https://blog.zhoujump.com/en/p/grid-transition/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Add transition animation for elements with uncertain height&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Sometimes we encounter this situation where the container is stretched by elements and its height cannot be known, but a smooth transition is required. Like this:&lt;/p&gt;
&lt;div class=&#34;cont&#34;&gt;
    &lt;div class=&#34;head&#34;&gt;Try touching my head with your mouse&lt;/div&gt;
    &lt;div class=&#34;body&#34;&gt;
        I am the content&lt;/br&gt;
        I am the content&lt;/br&gt;
        I am the content&lt;/br&gt;
        I am the content&lt;/br&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;style&gt;
    .cont{
    display:grid;
    background:#99e6ff;
    color:#006080;
    grid-template-rows: 30px 0fr;
    border-radius:8px;
    transition: .3s;
    padding:10px;
    line-height:30px;
    margin-bottom:20px;
    }
    .cont:hover{
    grid-template-rows: 30px 1fr;
    transition: .3s;
    
    }
    .body{
    min-height: 0;
    overflow:hidden;
    }
&lt;/style&gt;
&lt;p&gt;I believe that CSS beginners have tried this:&lt;/p&gt;</description>
        </item>
        
    </channel>
</rss>
