mirror of https://github.com/sveltejs/svelte
16 lines
354 B
16 lines
354 B
3 years ago
|
<script>
|
||
|
let bgOpacity = 0.5;
|
||
|
$: color = bgOpacity < 0.6 ? '#000' : '#fff';
|
||
|
</script>
|
||
|
|
||
|
<input type="range" min="0" max="1" step="0.1" bind:value={bgOpacity} />
|
||
|
|
||
|
<p style="color: {color}; --opacity: {bgOpacity};">This is a paragraph.</p>
|
||
|
|
||
|
<style>
|
||
|
p {
|
||
2 years ago
|
font-family: 'Comic Sans MS', cursive;
|
||
3 years ago
|
background: rgba(255, 62, 0, var(--opacity));
|
||
|
}
|
||
|
</style>
|