Toggle navigation
☰
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <style> .log-container { background-color: #f8f9fa; border: 1px solid #dee2e6; padding: 20px; border-radius: 8px; font-family: sans-serif; /* We define a base width to multiply our log result by */ --base-width: 80px; } .log-bar { background-color: #6f42c1; color: white; font-weight: bold; height: 40px; margin-bottom: 10px; display: flex; align-items: center; padding-left: 10px; border-radius: 4px; white-space: nowrap; /* Calculate the width using a base-10 logarithm: Base Width * log10(var(--val)) */ width: calc(var(--base-width) * log(var(--val), 10)); } .log-bar:last-child { margin-bottom: 0; } /* Assign raw data values to each bar */ .bar-1 { --val: 10; background-color: #b19cd9; color: #000; } .bar-2 { --val: 100; background-color: #9370db; } .bar-3 { --val: 1000; background-color: #6f42c1; } </style> <div class="log-container"> <div class="log-bar bar-1">Value: 10</div> <div class="log-bar bar-2">Value: 100</div> <div class="log-bar bar-3">Value: 1000</div> </div>