I am heading a problem that i cannot get around with. I have uploaded a background image and i want its opacity 0.4. Unfortunately when i do this all it's child elements get transparent too.
Below is the code that i have tried but seems like not working. I saw some solutions online with RGBA but each of them had plain background color and i am using a custom background.
<!doctype html>
<html>
<head>
<title></title>
</head>
<body>
<link rel="stylesheet" href="style.css"/>
<div id="main" align="center">
<div id="editable">
<input v-model="text" maxlength="30">
<p> {{ text }}</p>
</div>
<div id="root">
<h1>
{{message}}
</h1>
<button @click="ReverseMessage">Reverse Message</button>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.0"></script>
<script>
new Vue({
el: "#editable",
data: {
text: 'You can edit me'
}
});
new Vue({
el: "#root",
data: {
message: 'THIS MESSAGE WILL GET REVERSED IF YOU CLICK THE BUTTON'
},
methods: {
ReverseMessage() {
this.message = this.message.split('').reverse().join('')
}
}
});
Vue.config.devtools = true;
</script>
</body>
<style>
#main {
height: 609px;
background-image: url('HHH.jpg');
background-repeat: no-repeat;
background-size: cover;
opacity: 0.3;
}
#editable {
opacity: 1;
}
#root {
opacity: 1;
}
</style>
</html>