html - How to center a div and make it "sticky" then disappear -
i have been searching , trying sorts of things working. have site making want logo centered @ top of screen. z-index highest thing on page , stay in place while user scrolls down. then, logo passes div beneath it, have logo fade out.
so basically, want centered (responsive, possible?) div sits on top in z-space , stays put while scroll down. fades out begins running content down page.
codepen: https://codepen.io/anon/pen/gxkjno
if add position:fixed
either #logo
element or logo wrapper div (#logo_div
) breaks in different ways.
#logo-div { z-index: 1; width: 30vw; height: 30vh; margin: 0 auto; display: block; } #logo { max-height: 100%; max-width: 100%; margin: 0 auto; } #testy { display: block; overflow: hidden; position: relative; } #separator { background-color: white; z-index: -999; } #map-canvas { background-color: grey; z-index: : -998; }
<div id="logo-div"> <img id="logo" src="https://image.freepik.com/free-icon/apple-logo_318-40184.jpg"> </div> <div id="separator"> <p>lorem ipsum dolor sit amet</p> </div><!--seperator--> <div id="map-canvas"></div><!--map-canvas-->
wiki
Comments
Post a Comment