Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Background Image stretching in HTML

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #173402
    ani7ruddha
    Participant

    I have this website http://goo.gl/6QZNxZ

    The background image I have inserted this way–

    <div>
             <img />/images/home-background.jpg" alt="bg" />
         </div>

    So I probably cant use media queries for this..
    What can be best solution to this to avoid this image stretching issue

    #173404
    Paulie_D
    Member

    Why not actually use a background-image rather than an inline one/

    #173405
    ani7ruddha
    Participant

    I have added this to a div class..

    .home-bg img{
    background-size: cover;
    max-width: 100%;
    height:100%;
    }

    #173406
    Paulie_D
    Member

    The image shouldn’t be in a div, in fact, it shouldn’t be in the HTML at all. It should be in the CSS using the background-image property.

    https://css-tricks.com/perfect-full-page-background-image/

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.