How is application css overridden by BootstrapVue tables?
P粉545682500
P粉545682500 2024-02-21 15:35:24
0
2
368

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.

P粉545682500
P粉545682500

reply all(2)
P粉068510991

You can trymargin-top:-60px;

P粉821231319

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:

Vue.component('item', {
  template:'#list-template',
  props:['item'],
});

var vm = new Vue({
  el:"#app",
  computed: {
    limitedItems() {
      return ['item1'];
    }
  }
});
#app {
  border: 2px solid black;
  margin-top: 60px;
}
sssccc
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template