html - Making the cover image responsive on mobile devices -
i have cover photo on front page of website , looks fine on desktop , scales browser size being changed, looks absolutely horribly when opened on mobile device.
here's using:
.first { width: 100%; height: 100%; background-attachment: fixed; position:relative; background: url(../photo.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } i tried doing this:
@media screen , (max-width: 320px) { /* small screen, non-retina */ .first { background: url(../photo.jpg); width: 50%; height: 50%; } } @media screen , (min-resolution: 2dppx) , (max-width: 320px) { /* small screen, retina */ .first { background: url(../photo.jpg); width: 50%; height: 50%; } } but didn't work.
any appreciated!
we have unique class on image, set image absolutely positioned, , set width using percentage directly in css.
using same classes more once.
.first { background: url("../lyuba_final.jpg") no-repeat fixed center center / cover rgba(0, 0, 0, 0); height: 100%; left: 0; position: absolute; top: 0; width: 100%; } see reptition below

Comments
Post a Comment