html - how to display images correctly on mobile devices? -


mobile image

desktop browser image

the background image have 1920x1080p , displays correctly on desktop browsers not on mobile (not in portrait or landscape mode). anyway fix issue? need multiple images or there way automatically resize? .css file.

#tf-home{     background: url(../images/odysseytitleimage.jpg);     background-size: cover;     background-position: center;     background-attachment: fixed;     background-repeat: no-repeat;     color: #cfcfcf; }  #tf-home .overlay{     background: -moz-linear-gradient(top,  rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.73) 17%, rgba(0,0,0,0.66) 35%, rgba(0,0,0,0.55) 62%, rgba(0,0,0,0.4) 100%); /* ff3.6+ */     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.8)), color-stop(17%,rgba(0,0,0,0.73)), color-stop(35%,rgba(0,0,0,0.66)), color-stop(62%,rgba(0,0,0,0.55)), color-stop(100%,rgba(0,0,0,0.4))); /* chrome,safari4+ */     background: -webkit-linear-gradient(top,  rgba(0,0,0,0.8) 0%,rgba(0,0,0,0.73) 17%,rgba(0,0,0,0.66) 35%,rgba(0,0,0,0.55) 62%,rgba(0,0,0,0.4) 100%); /* chrome10+,safari5.1+ */     background: -o-linear-gradient(top,  rgba(0,0,0,0.8) 0%,rgba(0,0,0,0.73) 17%,rgba(0,0,0,0.66) 35%,rgba(0,0,0,0.55) 62%,rgba(0,0,0,0.4) 100%); /* opera 11.10+ */     background: -ms-linear-gradient(top,  rgba(0,0,0,0.8) 0%,rgba(0,0,0,0.73) 17%,rgba(0,0,0,0.66) 35%,rgba(0,0,0,0.55) 62%,rgba(0,0,0,0.4) 100%); /* ie10+ */     background: linear-gradient(to bottom,  rgba(0,0,0,0.8) 0%,rgba(0,0,0,0.73) 17%,rgba(0,0,0,0.66) 35%,rgba(0,0,0,0.55) 62%,rgba(0,0,0,0.4) 100%); /* w3c */     filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#cc000000', endcolorstr='#66000000',gradienttype=0 ); /* ie6-9 */     height: 1080px;     background-attachment: fixed; } .home-lead{     color: #fff;     padding: 10px 15px;     background-color: rgba(51, 51, 51, 0.9);     font-size: 21px; } .content{     position: relative;     padding: 30% 0 0; } 

this .html file

<div id="tf-home" class="text-center">     <div class="overlay">         <div class="content">             <div><a href="https://www.youtube.com/watch?v=hrlp0t41wcw" class="btn tf-btn btn-default popup-video">watch trailer</a></div>             <a href="#tf-game" class="fa fa-angle-down page-scroll"></a>         </div>     </div> </div> 

this caused height: 1080px; in #tf-home .overlay. looks on desktop because had necessary real estate large height. same height applied mobile, graphic's area larger average mobile viewport.

have tried creating more appropriate (smaller) height in media query mobile? eg.

@media (max-width: 600px) {     #tf-home{         background-attachment: scroll;     }     #tf-home .overlay {         height: 320px;     } } 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -