Styling
Arrange Elements
Set the size, spacing, and position of a menu in CSS.
Open a View or component and edit its <style scoped> section. For example,
this template and rule create a vertical menu:
<template>
<div class="menu">
<button>Play</button>
<button>Settings</button>
</div>
</template>
<style scoped>
.menu {
display: flex;
flex-direction: column;
width: 320px;
padding: 20px;
gap: 12px;
}
</style>Save and show it in Preview. The buttons should be stacked with space between them.
widthandheightset size.paddingadds space inside an element;marginadds space outside it.display: flexarranges children in a row or column.display: inline-flexdoes the same but keeps the element inline with surrounding text instead of taking a full line.position: relativeprovides a reference for absolutely positioned children.position: absoluteplaces content using offsets such astopandright.
Use Flexbox for most menu layouts. Grid is not supported. The CSS reference lists accepted properties and values.