Issue
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>
Solution
I had to change code as bellow
<style scoped>
.abc {
--background: blue;
}
</style>
and select the css class from toolbar
<ion-toolbar class="abc">
Answered By - mahfuj asif
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.