zhaw-moba2/Tasks/Task 01/navibar/navibar.js

29 lines
718 B
JavaScript
Raw Normal View History

2024-03-01 17:07:26 +00:00
class CustomNavigationBar extends HTMLElement {
constructor() {
super()
const shadowRoot = this.attachShadow({mode: 'open'})
shadowRoot.innerHTML = `
<style>
div.navibar {
align-items: center;
2024-03-15 09:52:34 +00:00
display: flex;
flex-wrap: nowrap;
justify-content: space-around;
2024-03-01 17:07:26 +00:00
background-color: #ccc;
margin: 0;
width: 100%;
}
::slotted(a) {
text-align: center;
2024-03-15 09:52:34 +00:00
margin: 10px;
height: 10vh;
2024-03-01 17:07:26 +00:00
}
</style>
<div class="navibar">
<slot></slot>
</div>`
}
}
customElements.define('navigation-bar', CustomNavigationBar)