Files
ladybird/Base/res/html/misc/progressbar.html
MacDue da79883b60 Base: Add the styled progress bar demo from css-tricks.com
See: https://css-tricks.com/html5-progress-element/ this is a neat
demo of a pure CSS progress bar that makes use of linear-gradients,
background-repeat, and background-size. All of which now work :^)
2022-08-08 22:39:06 +02:00

118 lines
3.5 KiB
HTML

<html>
<body>
<input type=button data-position="0" value="Set 0%">
<br>
<input type=button data-position="25" value="Set 25%">
<br>
<input type=button data-position="50" value="Set 50%">
<br>
<input type=button data-position="75" value="Set 75%">
<br>
<input type=button data-position="100" value="Set 100%">
<br>
<div style="display: inline-block;">
<pre>Progress bar position: <span id="position-text"></span></pre>
</div>
<br>
<br>
<em>A system progress bar (appearance: auto)</em>
<br>
<br>
<progress value="25" max="100"></progress>
<br>
<br>
<em>A primitive progress bar (appearance: none)</em>
<br>
<br>
<progress style="appearance: none" value="25" max="100"></progress>
<br>
<br>
<em>A primitive progress bar (appearance: none) with some styling</em>
<br>
<br>
<progress id="custom-progress" value="25" max="100"></progress>
<br>
<br>
<em>A super fancy progress bar done purely in CSS</em>
<br>
<br>
<progress id="really-fancy-progress" value="25" max="100"></progress>
<br>
<style>
body {
background-color: #060606;
color: white;
margin-left: 20px;
}
#custom-progress {
appearance: none;
width: 200px;
height: 20px;
}
#custom-progress::-webkit-progress-bar {
border-radius: 10px;
overflow: hidden;
box-shadow: 0 0 10px 4px #ff3863d2;
background-color: #eee;
}
#custom-progress::-webkit-progress-value {
border-radius: 10px;
background-color: #ff3863d2;
}
/* The following example is taken from https://css-tricks.com/html5-progress-element/ */
#really-fancy-progress[value] {
appearance: none;
width: 500px;
height: 40px;
}
#really-fancy-progress[value]::-webkit-progress-bar {
background-color: #eee;
border-radius: 2px;
/* FIXME: Should be an inset shadow (not supported yet) */
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}
#really-fancy-progress[value]::-webkit-progress-value {
background-image:
-webkit-linear-gradient(-45deg,
transparent 33%, rgba(0, 0, 0, .1) 33%,
rgba(0,0, 0, .1) 66%, transparent 66%),
-webkit-linear-gradient(top,
rgba(255, 255, 255, .25),
rgba(0, 0, 0, .25)),
-webkit-linear-gradient(left, #09c, #f44);
border-radius: 2px;
background-size: 70px 40px, 100% 100%, 100% 100%;
}
</style>
<script>
const progressBars = document.querySelectorAll('progress');
const buttons = document.querySelectorAll('input[type=button]');
const positionText = document.getElementById('position-text');
const setProgressPositions = (position) => {
progressBars.forEach(progressBar => {
progressBar.value = position;
})
positionText.innerHTML = position;
}
buttons.forEach(button => {
button.onclick = event => {
const position = event.target.getAttribute("data-position") | 0;
setProgressPositions(position);
}
})
</script>
</body>
</html>