Forums

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

Home Forums CSS responsive bg image

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #150621
    asma
    Participant

    i am making a responsive web design. i have a div with background image and this div is taking 100% of the body and padding bottom of 64%.it works perfectly responsive, but my problem is when i make another div with same background-image,padding bottom and 100% width and preview it in browser the hight of the first div shrinks. my question is why first div shrinks when secon div is placed just after it?

    #150660
    sadunaresh
    Participant
    100% of the body
    

    both width and height…?

    a PEN would help us in helping you….

    #150681
    Paulie_D
    Member

    this div is taking 100% of the body and padding bottom of 64%

    I’d love to know why it needs that much bottom padding.

    #150770
    asma
    Participant

    the container div is taking 100% of the screen. that much bottom padding is to set its hight.

    #150772
    asma
    Participant

    what i mean to say is that much bottom padding is to resolve hight issue.is there any other way to set hight for responsive background images? plz a code pen would be helpfull for responsive background image.

    #150774
    Junni
    Participant

    Dear Asma AOA, first you have to give a code pen about you problem then it will be more easy for us to solve that problem

    #150779
    Paulie_D
    Member
    #150792
    asma
    Participant

    http://jsfiddle.net/mEuEe/ here is my code.the width of the wrapper div shrinks with the browser size but not the hight whigh makes the background image elongated. how to make hight responsive?

    #150829
    Paulie_D
    Member

    Try using background-size: cover;

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