html - Add text to background image using CSS -
i using background image on section covers whole screen while section in view. covered subsequent sections page scrolls.
#section1{ background: url(../sitedata/images/sectionbackground.jpg) no-repeat center top fixed #f1ece2; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; min-height:800px; }
i want add text half way down image. can do, want stay in position, if part of image. when screen scrolls up, text gets hidden rather scrolls top - stays in position on image.
how this?
thanks
here demo answer make them both image , text responsive live on fiddle. try not copy paste. try understand css how text on image. if have questions ask me in comment. best of luck.
.img-reponsive { display: block; max-width: 100%; height: auto; margin: 0 auto; } .textoverimage { position: relative; } p.title { position: absolute; top: 75px; left: 0; text-align: center; font-size: 38px; width: 100%; color: #fff } @media screen , (max-width: 767px) { p.title { font-size: 1.5em; line-height: 1.5em; } } @media screen , (max-width: 479px) { p.title { font-size: 1.1em; line-height: 1.1em; } }
<div class="textoverimage"> <img class="img-reponsive" src="http://cdn.shopify.com/s/files/1/0258/1101/t/2/assets/slideshow_3.jpg?5808719635421587686" alt="demo_img"> <p class="title"> text </p> </div>
Comments
Post a Comment