Hi i hope you are well.
I have an issue and i couldn't fix it i want to attach a background-image
property from url and want to add an opacity with color on it who will not affect the childs.
Actually everything take the opacity if someone can help me it will be great !
Thank you by advance
Here is my sample of code:
<template>
<Page class="ns-light page">
<ActionBar :title="`${actionBarName}`"/>
<StackLayout orientation="vertical" style="text-align: center; margin-top: 5%">
<Label text="Tap to play the music" style="font-weight: bold"/>
<Image :src="src" @tap="playSound" width="300" style="margin-top: 5%"/>
</StackLayout>
</Page>
</template>
<style scoped>
ActionBar {
background-color: #53ba82;
color: #ffffff;
}
.page {
background: url('~/assets/images/cards/background.png') no-repeat center #53ba82;
background-size: cover;
opacity: 0.5;
}
</style>
So thanks to: Tao who took the time to answer me
After trying a lot of things i read the documentation and found out how to do it !
Problematic: "i want an image as a background and a transparent color above the image."
I will explain myself, so i tried to apply css
background-image
and adding the opacity to it.opacity
The
opacity
is going to modify all of the elements inside your chosen element.When i used
opacity
inPage
it even changed the opacity of the image and that was not what i was looking for ...alpha
(rgba
)And then i thought there is
alpha = rgba()
and you can achieve the transparency of the specific element so = "a color transparent above the image."So what I did was very simple, I had to see if I could define an rgba class on one of the child elements and i chose:
GridLayout
(the Layout Container).So i added a
background-color: rgba(0, 255, 0, 0.1)
and then i had the color with transparencyAnd i let the
background-image
onPage
component and that did the trick ! :DI will put the code of it with the second code over here: