You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/documentation/tutorial/13-advanced-styling/03-inline-styles/app-a/App.svelte

16 lines
306 B

<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>This is a paragraph.</p>
<style>
p {
font-family: 'Comic Sans MS', cursive;
background: rgba(255, 62, 0, var(--opacity));
}
</style>