Fix HTML and CSS order and format CSS.

pull/6213/head
Babak F 5 years ago
parent b8810b8224
commit 538e07dee9

@ -1,5 +1,7 @@
<strong>Blue thing</strong>
<style> <style>
strong { color: blue; } strong {
color: blue;
}
</style> </style>
<strong>blue thing</strong>

@ -1,5 +1,7 @@
<strong>Green thing</strong>
<style> <style>
strong { color: green; } strong {
color: green;
}
</style> </style>
<strong>green thing</strong>

@ -1,5 +1,7 @@
<strong>Red thing</strong>
<style> <style>
strong { color: red; } strong {
color: red;
}
</style> </style>
<strong>red thing</strong>

@ -1,5 +1,7 @@
<strong>Blue thing</strong>
<style> <style>
strong { color: blue; } strong {
color: blue;
}
</style> </style>
<strong>blue thing</strong>

@ -1,5 +1,7 @@
<strong>Green thing</strong>
<style> <style>
strong { color: green; } strong {
color: green;
}
</style> </style>
<strong>green thing</strong>

@ -1,5 +1,7 @@
<strong>Red thing</strong>
<style> <style>
strong { color: red; } strong {
color: red;
}
</style> </style>
<strong>red thing</strong>

@ -8,6 +8,17 @@
} }
</script> </script>
<svelte:window/>
<div style="text-align: center">
{#if key}
<kbd>{key === ' ' ? 'Space' : key}</kbd>
<p>{keyCode}</p>
{:else}
<p>Focus this window and press any key</p>
{/if}
</div>
<style> <style>
div { div {
display: flex; display: flex;
@ -29,14 +40,3 @@
color: #555; color: #555;
} }
</style> </style>
<svelte:window/>
<div style="text-align: center">
{#if key}
<kbd>{key === ' ' ? 'Space' : key}</kbd>
<p>{keyCode}</p>
{:else}
<p>Focus this window and press any key</p>
{/if}
</div>

@ -8,6 +8,17 @@
} }
</script> </script>
<svelte:window on:keydown={handleKeydown}/>
<div style="text-align: center">
{#if key}
<kbd>{key === ' ' ? 'Space' : key}</kbd>
<p>{keyCode}</p>
{:else}
<p>Focus this window and press any key</p>
{/if}
</div>
<style> <style>
div { div {
display: flex; display: flex;
@ -29,14 +40,3 @@
color: #555; color: #555;
} }
</style> </style>
<svelte:window on:keydown={handleKeydown}/>
<div style="text-align: center">
{#if key}
<kbd>{key === ' ' ? 'Space' : key}</kbd>
<p>{keyCode}</p>
{:else}
<p>Focus this window and press any key</p>
{/if}
</div>

@ -11,15 +11,15 @@
}); });
</script> </script>
<!-- the text will flash red whenever
the `todo` object changes -->
<div bind:this={div} on:click>
{todo.done ? '👍': ''} {todo.text}
</div>
<style> <style>
div { div {
cursor: pointer; cursor: pointer;
line-height: 1.5; line-height: 1.5;
} }
</style> </style>
<!-- the text will flash red whenever
the `todo` object changes -->
<div bind:this={div} on:click>
{todo.done ? '👍': ''} {todo.text}
</div>

@ -13,15 +13,15 @@
}); });
</script> </script>
<!-- the text will flash red whenever
the `todo` object changes -->
<div bind:this={div} on:click>
{todo.done ? '👍': ''} {todo.text}
</div>
<style> <style>
div { div {
cursor: pointer; cursor: pointer;
line-height: 1.5; line-height: 1.5;
} }
</style> </style>
<!-- the text will flash red whenever
the `todo` object changes -->
<div bind:this={div} on:click>
{todo.done ? '👍': ''} {todo.text}
</div>

@ -1,3 +1,9 @@
<div class="box">
<slot name="header">No header was provided</slot>
<p>Some content between header and footer</p>
<slot name="footer"></slot>
</div>
<style> <style>
.box { .box {
width: 300px; width: 300px;
@ -12,9 +18,3 @@
gap: 1em; gap: 1em;
} }
</style> </style>
<div class="box">
<slot name="header">No header was provided</slot>
<p>Some content between header and footer</p>
<slot name="footer"></slot>
</div>

@ -1,3 +1,9 @@
<div class="box">
<slot name="header">No header was provided</slot>
<p>Some content between header and footer</p>
<slot name="footer"></slot>
</div>
<style> <style>
.box { .box {
width: 300px; width: 300px;
@ -12,9 +18,3 @@
gap: 1em; gap: 1em;
} }
</style> </style>
<div class="box">
<slot name="header">No header was provided</slot>
<p>Some content between header and footer</p>
<slot name="footer"></slot>
</div>

@ -8,6 +8,12 @@ In the example notice how we applied a flex layout with a gap of `1em` to the bo
```sv ```sv
<!-- Box.svelte --> <!-- Box.svelte -->
<div class="box">
<slot name="header">No header was provided</slot>
<p>Some content between header and footer</p>
<slot name="footer"></slot>
</div>
<style> <style>
.box { .box {
display: flex; display: flex;
@ -15,12 +21,6 @@ In the example notice how we applied a flex layout with a gap of `1em` to the bo
gap: 1em; gap: 1em;
} }
</style> </style>
<div class="box">
<slot name="header">No header was provided</slot>
<p>Some content between header and footer</p>
<slot name="footer"></slot>
</div>
``` ```
However, the content in the footer is not spaced out according to this rhythm because wrapping it in a div created a new flow layout. However, the content in the footer is not spaced out according to this rhythm because wrapping it in a div created a new flow layout.

@ -17,13 +17,6 @@
} }
</script> </script>
<style>
article { margin: 0 0 1em 0; max-width: 800px }
h2, p { margin: 0 0 0.3em 0; }
audio { width: 100%; margin: 0.5em 0 1em 0; }
.playing { color: #ff3e00; }
</style>
<article class:playing={!paused}> <article class:playing={!paused}>
<h2>{title}</h2> <h2>{title}</h2>
<p><strong>{composer}</strong> / performed by {performer}</p> <p><strong>{composer}</strong> / performed by {performer}</p>
@ -36,3 +29,18 @@
{src} {src}
></audio> ></audio>
</article> </article>
<style>
article {
margin: 0 0 1em 0; max-width: 800px;
}
h2, p {
margin: 0 0 0.3em 0;
}
audio {
width: 100%; margin: 0.5em 0 1em 0;
}
.playing {
color: #ff3e00;
}
</style>

@ -25,13 +25,6 @@
} }
</script> </script>
<style>
article { margin: 0 0 1em 0; max-width: 800px }
h2, p { margin: 0 0 0.3em 0; }
audio { width: 100%; margin: 0.5em 0 1em 0; }
.playing { color: #ff3e00; }
</style>
<article class:playing={!paused}> <article class:playing={!paused}>
<h2>{title}</h2> <h2>{title}</h2>
<p><strong>{composer}</strong> / performed by {performer}</p> <p><strong>{composer}</strong> / performed by {performer}</p>
@ -44,3 +37,18 @@
{src} {src}
></audio> ></audio>
</article> </article>
<style>
article {
margin: 0 0 1em 0; max-width: 800px;
}
h2, p {
margin: 0 0 0.3em 0;
}
audio {
width: 100%; margin: 0.5em 0 1em 0;
}
.playing {
color: #ff3e00;
}
</style>

@ -31,13 +31,6 @@
} }
</script> </script>
<style>
article { margin: 0 0 1em 0; max-width: 800px }
h2, p { margin: 0 0 0.3em 0; }
audio { width: 100%; margin: 0.5em 0 1em 0; }
.playing { color: #ff3e00; }
</style>
<article class:playing={!paused}> <article class:playing={!paused}>
<h2>{title}</h2> <h2>{title}</h2>
<p><strong>{composer}</strong> / performed by {performer}</p> <p><strong>{composer}</strong> / performed by {performer}</p>
@ -50,3 +43,18 @@
{src} {src}
></audio> ></audio>
</article> </article>
<style>
article {
margin: 0 0 1em 0; max-width: 800px;
}
h2, p {
margin: 0 0 0.3em 0;
}
audio {
width: 100%; margin: 0.5em 0 1em 0;
}
.playing {
color: #ff3e00;
}
</style>

@ -33,6 +33,10 @@
}); });
</script> </script>
{#each confetti as c}
<span style="left: {c.x}%; top: {c.y}%; transform: scale({c.r})">{c.character}</span>
{/each}
<style> <style>
:global(body) { :global(body) {
overflow: hidden; overflow: hidden;
@ -43,7 +47,3 @@
font-size: 5vw; font-size: 5vw;
} }
</style> </style>
{#each confetti as c}
<span style="left: {c.x}%; top: {c.y}%; transform: scale({c.r})">{c.character}</span>
{/each}
Loading…
Cancel
Save