Skip to content

Instantly share code, notes, and snippets.

@lega911
Created May 15, 2021 21:48
Show Gist options
  • Save lega911/10f9c9b24e3dadf4add73c62e242a1b7 to your computer and use it in GitHub Desktop.
Save lega911/10f9c9b24e3dadf4add73c62e242a1b7 to your computer and use it in GitHub Desktop.
Passing class to component
<script>
import Box from './Box.xht';
</script>
<Box class="purple">Purple class</Box>
<Box class="green">Green</Box>
<style>
.purple {
background: rebeccapurple;
width: 8rem;
color: white;
}
.purple:hover {
background: #b7a8c6;
width: 8rem;
color: black;
}
.green {
background: lightseagreen;
width: 4rem;
color: white;
}
</style>
<div class="main">
<slot>Hello</slot>
</div>
<style>
.main {
margin: 1rem;
padding: 0.4rem;
}
</style>
<style external>
.main {
background: red;
width: 4rem;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment