-2

I have started learning ionic vue. I am trying to use css with ionic components. So I added style to the same file

<style scoped>
    .abc {
        background-color: blue;
    }
</style>

And tried to access it with

<ion-content class ="abc">
    <ion-header>
        <ion-toolbar>
            <ion-title size="large">My Navigation Bar</ion-title>
        </ion-toolbar>
    </ion-header>
</ion-content>

But it is not working. How do i do this? Here is my full code

<template>
  <ion-page>
    <ion-content class ="abc">
        <ion-header>
          <ion-toolbar>
            <ion-title size="large">My Navigation Bar</ion-title>
          </ion-toolbar>
        </ion-header>
    </ion-content>
  </ion-page>
</template>

<script>
    import { IonContent, IonPage } from "@ionic/vue";
    import { defineComponent } from "vue";

    export default defineComponent({
        name: "Home",
        components: {
            IonContent,
            IonPage
        },
    });
</script>

<style scoped>
    .abc {
        background-color: blue;
    }
</style>
mahfuj asif
  • 1,691
  • 1
  • 11
  • 32

1 Answers1

0

I had to change code as bellow

<style scoped>
    .abc {
        --background: blue;
    }
</style>

and select the css class from toolbar

<ion-toolbar class="abc">
mahfuj asif
  • 1,691
  • 1
  • 11
  • 32