angular project problem

I have two component hero section and nav-bar component.i want to set a comman background for both of them.does anyone have idea how i can achieve this.. I tried adding both component in a parent div in app component and setting background image to parent div. And also setting background as transparent for both component. But it doesnt seems to work. Any idea how i can solve this problem.
1 Reply
clevermissfox
clevermissfox9mo ago
create a utility class .background-forest {background: url(//forest.com/trees.png) or define a custom property in the root
:root { --forest-bg: url(//forest.com/trees.png)} .hero {background: var(--forest-bg)}
.nav{background: var(--forest-bg);}
:root { --forest-bg: url(//forest.com/trees.png)} .hero {background: var(--forest-bg)}
.nav{background: var(--forest-bg);}
or a combination of the two; define a custom property with the background and then use it on the utility class background-forest {background: var(--forest-bg;} <div class="nav background-forest"></div> <div class="hero background-forest"></div>
Want results from more Discord servers?
Add your server