I have a simple BootstrapVue table.
CSS is defined in App.vue
. This is the code for App.vue
.
<template> <div id="app"> <!-- <img alt="Vue logo" src="./assets/logo.png"> --> <TestTable msg="testing"/> </div> </template> <script> import TestTable from './components/TestTable.vue' export default { name: 'App', components: { TestTable } } </script> <style> #app { font-family: Avenir, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; margin-top: 60px; } </style>
This is the code for TestTable.vue
.
<template> <div> <b-table striped hover :items="items"></b-table> </div> </template> <script> export default { data() { return { items: [ { age: 40, first_name: 'Dickerson', last_name: 'Macdonald' }, { age: 21, first_name: 'Larsen', last_name: 'Shaw' }, { age: 89, first_name: 'Geneva', last_name: 'Wilson' }, { age: 38, first_name: 'Jami', last_name: 'Carney' } ] } } } </script>
margin-top: 60px
Defined in App.vue
. I want to modify TableTest.vue
so that it covers the top of the margin of the CSS in App.vue
. I want margin-top: 0px
for TableTest.vue
.
I'm using Vue v2.6 and Bootstrap-vue.
You can try
margin-top:-60px;
I commented on your question before, you applied
margin-top: 60px
in the parent component, while the child component has its own box model.Add a code snippet to show the structure of the component: