|
| 1 | +/* Style for the body of the page */ |
| 2 | +body { |
| 3 | + /* Light and pleasant background color */ |
| 4 | + background-color: #f0f4f8; |
| 5 | + /* Use Flexbox to center content */ |
| 6 | + display: flex; |
| 7 | + justify-content: center; |
| 8 | + align-items: center; |
| 9 | + /* Set height to viewport height to occupy the full window */ |
| 10 | + height: 100vh; |
| 11 | + /* Remove default margins */ |
| 12 | + margin: 0; |
| 13 | + /* Use a sans-serif font for a modern look */ |
| 14 | + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; |
| 15 | +} |
| 16 | + |
| 17 | +/* Style for the counter container */ |
| 18 | +.counter-container { |
| 19 | + /* White background for contrast */ |
| 20 | + background-color: #ffffff; |
| 21 | + /* Internal padding for spacing */ |
| 22 | + padding: 40px 60px; |
| 23 | + /* Rounded corners for a softer design */ |
| 24 | + border-radius: 12px; |
| 25 | + /* Light shadow for depth */ |
| 26 | + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); |
| 27 | + /* Center the text */ |
| 28 | + text-align: center; |
| 29 | +} |
| 30 | + |
| 31 | +/* Style for the counter number */ |
| 32 | +.counter { |
| 33 | + /* Large font size for visibility */ |
| 34 | + font-size: 80px; |
| 35 | + /* Bold text */ |
| 36 | + font-weight: bold; |
| 37 | + /* Initial text color */ |
| 38 | + color: #3a86ff; |
| 39 | + /* Relative positioning for pseudo-elements */ |
| 40 | + position: relative; |
| 41 | + /* Inline-block display to manage dimensions and margins */ |
| 42 | + display: inline-block; |
| 43 | + /* Transition for color change */ |
| 44 | + transition: color 0.3s ease; |
| 45 | +} |
| 46 | + |
| 47 | +/* Style applied when the 'animate' class is added */ |
| 48 | +.counter.animate { |
| 49 | + /* Change text color for animation */ |
| 50 | + color: #8338ec; |
| 51 | +} |
| 52 | + |
| 53 | +/* Style for the plus sign that appears after the number */ |
| 54 | +.counter::after { |
| 55 | + /* Add content: the '+' sign */ |
| 56 | + content: '+'; |
| 57 | + /* Font size for the plus sign */ |
| 58 | + font-size: 40px; |
| 59 | + /* Absolute positioning relative to the counter */ |
| 60 | + position: absolute; |
| 61 | + /* Position at the top-right of the number */ |
| 62 | + top: 10px; |
| 63 | + right: -30px; |
| 64 | + /* Initial color of the plus sign */ |
| 65 | + color: #3a86ff; |
| 66 | + /* Initial opacity set to zero for animation */ |
| 67 | + opacity: 0; |
| 68 | + /* Initial translation for sliding effect */ |
| 69 | + transform: translateX(10px); |
| 70 | + /* Transitions for opacity and transformation */ |
| 71 | + transition: opacity 0.3s ease-out, transform 0.3s ease-out; |
| 72 | +} |
| 73 | + |
| 74 | +/* Animation style for the plus sign when 'animate' class is present */ |
| 75 | +.counter.animate::after { |
| 76 | + /* Full opacity to make the plus sign visible */ |
| 77 | + opacity: 1; |
| 78 | + /* Reset translation to bring the plus sign into position */ |
| 79 | + transform: translateX(0); |
| 80 | + /* Change color of the plus sign for animation */ |
| 81 | + color: #8338ec; |
| 82 | +} |
0 commit comments