html - CSS3 layout with position: absolute pushing down content -


i have responsive page need insert various content in different heights:

  • the upper part image gradient overlay (red).

  • beneath div same color (blue), looks smooth transition between 2 divs.

example

the issue content (yellow) needs push down blue div depending on how content inside yellow div, yellow div needs position: absolute displayed is.

is doable in pure css? or need javascript calculate hight of blue div?

here fiddle.

html

<div class="pr">     <img src="http://www.cphrecmedia.dk/musikdk/stage/demobilleder/detartistchannel2.jpg">     <div id="campaignreleases"></div>     <img id="camlogo" src="http://www.cphrecmedia.dk/musikdk/stage/css/lyttesession.svgz" alt="musikdk logo"> </div> <div id="camrel">     <img src="http://www.cphrecmedia.dk/musikdk/stage/demobilleder/detlyttealbum.jpg" alt="albumname">     <p>below need add whatever i'll need. needs push down "camrel" div, content needs positioned below logo (inside "pr" div)</p> </div> 

css

body {     background: #ddd } .pr {     position: relative;     width: 800px } .pr img {     width: 100% } #campaignreleases {     position: absolute;     top:0;     bottom:0;     left:0;     right:0;     background: -moz-linear-gradient(top, rgba(26, 188, 156, 0.2) 0%, rgba(26, 188, 156, 1) 100%);     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(26, 188, 156, 0.2)), color-stop(100%, rgba(26, 188, 156, 1))); } #camlogo {     position: absolute;     -webkit-transform: translatex(-50%);     left: 50%;     top:15%;     opacity: 1 !important;     max-width: 500px } #camrel {     background: #1abc9c;     text-align: center;     overflow: auto; } #camrel img {     width: 250px;     .roundedcorners; } 

it's doable pure css, need turn way it's cssed around. red , blue div need position: absolute; since height doesn't change, , yellow div should have position: relative; because div set height of document.

you might problem background color way. can solved giving body same background color blue div.

in case unclear, or still have no idea how it, let me know. i'd happy help.


edit: i've created fiddle using yours, create explained above.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -