Adam Weitzman Adam Weitzman - 2 months ago 34
CSS Question

Angular Material Transparent Toolbar

I'm using angular material on a rails app, want a toolbar to sit on top of an image and make that toolbar clear so you can see the image behind it. Here is the code so far:

<div layout="column" layout-fill>
<div layout="row">
<img src="http://www.outsideonline.com/sites/default/files/styles/full-page/public/yosemite-smart-black-bear_h.jpg?itok=kKS8ILd9">
<md-toolbar id="toolbar" class="transparent">
<div class="md-toolbar-tools">
<span>Turbo Mortgages</span>
<!-- fill up the space between left and right area -->
<span flex></span>
<md-button ui-sref="app.register"
aria-label="Toggle Mobile Navigation">
About
</md-button>
<md-button ui-sref="app.join"
aria-label="Toggle Mobile Navigation">
Join
</md-button>
<md-button ui-sref="app.login"
aria-label="Toggle Mobile Navigation">
Login
</md-button>
</div>
</md-toolbar>
</div>
<md-content>
<ng-view></ng-view>
</md-content>




and what I see on the page right now is just the image...here is the css:

#toolbar {
position:relative;
z-index:1000;
}


how do i get the toolbar to lay on top of the image if not with z-index? thanks for help!

Answer

I ended up making the image the background of the toolbar...You could also set the

position: absolute
background-color:transparent

on the toolbar to place it over the image