This article brings you the content is about how to use the pure CSS to achieve the Windows Start interface animation effect, there is a certain reference value, the need for friends can refer to, I hope to help you.
Effect Preview
Source code Download
Https://github.com/comehope/front-end-daily-challenges
Code interpretation
Define the DOM, the container contains 2 elements, respectively, representing the logo and progress bar, the logo also contains 3 paragraphs of text:
<div class= "Windows-boot" > <div class= "logo" > <p class= "MS" >Microsoft</p> <p class= "Win" >Windows</p> <p class= "Pro" >Professional</p> </div> < Div class= "Bar" ></div></div>
Center display:
body { margin:0; HEIGHT:100VH; Display:flex; Align-items:center; Justify-content:center; Background-color:black;}
Define Container Dimensions:
. windows-boot { width:21.5em; Height:15em;}
To set paragraph styles:
. logo p { color:white; Font-family:sans-serif; margin:0; padding:0;}
Set Font Size:
. logo. ms { font-size:1.6em;}. Logo. Win { font-size:4.2em;}. Logo. Pro { font-size:3em;}
To set the font weight:
. logo. ms { font-weight:lighter;}. Logo. Win { font-weight:bold;}. Logo. Pro { font-weight:lighter;}
Set line height:
. logo. ms { line-height:1em;}. Logo. Win { line-height:86%;}. Logo. Pro { line-height:1em; Padding-left:0.2em;}
Add a trademark copyright symbol after "Microsoft":
. logo. ms::after { content: ' \00a9 '; font-size:0.625em; Vertical-align:top; position:relative; Top: -0.3em; Left:0.2em;}
Add "XP" after "Windows":
. logo. win::after { content: ' XP '; font-size:0.5em; Vertical-align:top; position:relative; Top: -0.4em; Color:tomato;}
To define a progress bar size:
. bar { width:15em; Height:1em; Border:0.2em solid silver;}
Increase the spacing between the logo and the progress bar:
. windows-xp-loader { Display:flex; Flex-direction:column; Justify-content:space-between; Align-items:center;}
To set the style of a progress bar:
. bar { border-radius:0.7em; position:relative; Padding:0.2em;}. Bar::before { content: '; Position:absolute; Width:3em; height:70%; Background-color:dodgerblue; Border-radius:0.2em;}
Sets the style of the blue color block in the progress bar with a linear gradient:
. bar::before { background: linear-gradient (to right , transparent 30%, black 30%, Black 35%, transparent 35%, transparent 65%, black 65%, black 70%, transparent 70% ), linear-gradient ( Blue 0, royalblue 17%, deepskyblue 32%, Deepskyblue 45%, royalblue 60%, blue 100% ); C25/>filter:brightness (1.2);}
Add animation effects:
. bar::before { animation:run 2s linear infinite;} @keyframes Run {from { Transform:translatex ( -3em); } to { Transform:translatex (15em); }}
Finally, hide the content outside the progress bar:
. bar { Overflow:hidden;}
Done!