<div class="chart-container"> <h2 class="chart-title">Monthly Sales Report</h2> <div class="chart"> <div class="y-axis"> <span class="y-label">100</span> <span class="y-label">75</span> <span class="y-label">50</span> <span class="y-label">25</span> <span class="y-label">0</span> </div> <div class="bar-wrapper"> <div class="bar bar-1"> <span class="bar-value">75</span> </div> <div class="bar-label">Jan</div> </div> <div class="bar-wrapper"> <div class="bar bar-2"> <span class="bar-value">90</span> </div> <div class="bar-label">Feb</div> </div> <div class="bar-wrapper"> <div class="bar bar-3"> <span class="bar-value">60</span> </div> <div class="bar-label">Mar</div> </div> <div class="bar-wrapper"> <div class="bar bar-4"> <span class="bar-value">85</span> </div> <div class="bar-label">Apr</div> </div> <div class="bar-wrapper"> <div class="bar bar-5"> <span class="bar-value">70</span> </div> <div class="bar-label">May</div> </div> </div> </div>
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f5f5f5; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; } .chart-container { background: white; padding: 40px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); max-width: 800px; width: 100%; } .chart-title { text-align: center; margin-bottom: 40px; color: #333; font-size: 1.8rem; font-weight: 300; } .chart { display: flex; align-items: flex-end; justify-content: space-around; height: 400px; border-bottom: 2px solid #ddd; border-left: 2px solid #ddd; padding: 20px 0 0 60px; position: relative; } .y-axis { position: absolute; left: 10px; top: 0; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 20px 0; } .y-label { font-size: 0.85rem; color: #666; } .bar-wrapper { display: flex; flex-direction: column; align-items: center; flex: 1; max-width: 100px; } .bar { width: 60px; background: linear-gradient(180deg, #4a90e2 0%, #2e5f9e 100%); border-radius: 8px 8px 0 0; position: relative; transition: all 0.3s ease; animation: growBar 1.5s ease-out; } @keyframes growBar { from { height: 0; } } .bar:hover { background: linear-gradient(180deg, #5ca3f5 0%, #3d6fb0 100%); transform: translateY(-5px); box-shadow: 0 8px 15px rgba(74, 144, 226, 0.3); } .bar-value { position: absolute; top: -30px; left: 50%; transform: translateX(-50%); font-weight: 600; color: #4a90e2; font-size: 0.9rem; } .bar-label { margin-top: 15px; font-size: 0.9rem; color: #555; text-align: center; } /* Individual bar heights */ .bar-1 { height: 75%; } .bar-2 { height: 90%; } .bar-3 { height: 60%; } .bar-4 { height: 85%; } .bar-5 { height: 70%; } @media (max-width: 600px) { .chart-container { padding: 20px; } .chart-title { font-size: 1.4rem; margin-bottom: 30px; } .chart { height: 300px; } .bar { width: 40px; } .bar-label { font-size: 0.75rem; } .y-label { font-size: 0.75rem; } }
Login to leave a comment
No comments yet. Be the first!
View Project
No comments yet. Be the first!