• Resolved richard.miller

    (@richardmiller-1)


    I want the background image in my footer to resize proportionately, just like the header image automatically does.

    And I’ve achieved that mostly, but am running into a problem:

    If I understand correctly, the height/width in the stylesheet need to be set up this way for automatic resizing:

    max-width:100%;height:auto;

    But when I apply that, “auto” doesn’t find the height of my background image, and the div collapses, showing almost nothing of the image.

    If I change that “auto” height to the pixel size of my background image, it looks great until I resize. Then the div height (of course) remains at that pixel value instead of shrinking.

    Here’s the footer code:

    #colophon {
    	position:relative;
    	background: url(images/RAMS_footer.png) center top no-repeat;
    	background-size:100%;
    	max-width:100%;height:auto;
    	padding:0px;
            border-top: 0;
    	margin-top:0px;
    	margin-top:0rem;
    }

    And here’s the site:

    http://ratchetsaway.com

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    But when I apply that, “auto” doesn’t find the height of my background image, and the div collapses, showing almost nothing of the image.

    Standard behavior.

    What if you use something like 13rem as the height value?

    Thread Starter richard.miller

    (@richardmiller-1)

    Thanks, Andrew.

    Tried it, and it gives me the same non-shrinking height results – that is, the graphic gets smaller, but the height of the Colophon ID stays the same, showing a bunch of ugly white space underneath the re-sized graphic.

    Take a look:

    http://ratchetsaway.com

    It seems like it must be possible … the header graphic resizes beautifully! I just can’t figure out what the difference is.

    Thread Starter richard.miller

    (@richardmiller-1)

    Figured out a solution that works well enough.

    For some reason it wouldn’t work with the Colophon ID, so I used absolute/relative positioning to overlay another div on top of it, and stick the background image to the bottom of the div.

    Richard,

    Please explain in detail to this newbie what you mean. I’ve got a 1000px wide by 50 px high image in the footer. When I resize the screen, the height stays, as it should, but the width doesn’t reduce. However it does remain at 1000px when the screen is widened.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Automatically resizing footer image – height problem’ is closed to new replies.