twitter bootstrap 3 - Show image on top of the background color in CSS -
i using bootstrap , have layout similar this:
<div class="container stamp"> <div class="row"> header text </div> <div class="row" style="background-color:black"> more header text here </div> <div class="row"> more text </div> </div>
i've set background image overlaps 3 rows
.stamp { background-image: url('img/hugestamp.gif'); background-repeat: no-repeat; background-position: left top; }
the hugestamp.gif
spans across 3 rows second row has background color of black, part of image cut off. how make image show on top of background color (maybe z-index
?) on 2nd row?
edit: cannot make colored row transparent. trying achieve styling here:
in image, can see 3 rows , how image shown on top of colored row
try code
image on colored row
.stamp { background-image: url('http://imgh.us/new-google-logo-knockoff.png'); background-repeat: no-repeat; background-position: 0 -69px; background-size: 100% auto; position: absolute; left: 0; top: 0; width: 100%; height: 100%; } .container{ position:relative }
<div class="container"> <div class="row"> header text </div> <div class="row" style="background-color:black"> more header text here </div> <div class="row"> more text </div> <div class="stamp"></div> </div>
image on colored row containing text
.stamp { background-image: url('http://imgh.us/new-google-logo-knockoff.png'); background-repeat: no-repeat; background-position: 0 -69px; background-size: 100% auto; position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 15; } .container{ position:relative } .row:nth-child(2):after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 100%; background-color: #000; z-index: -20; } .row:nth-child(2) { position: relative; z-index: 10; color: #fff; }
<div class="container"> <div class="row"> header text </div> <div class="row"> more header text here </div> <div class="row"> more text </div> <div class="stamp"></div> </div>
image on colored row , below text
.stamp { background-image: url('http://imgh.us/new-google-logo-knockoff.png'); background-repeat: no-repeat; background-position: 0 -69px; background-size: 100% auto; position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: -10; } .container{ position:relative } .row:nth-child(2):after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 100%; background-color: #000; z-index: -20; } .row:nth-child(2) { position: relative; color: #fff; }
<div class="container"> <div class="row"> header text </div> <div class="row"> more header text here </div> <div class="row"> more text </div> <div class="stamp"></div> </div>
Comments
Post a Comment