Forums

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

Home Forums CSS Make header image scale?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #37972
    brent_james
    Member

    Is there a way in CSS to make the header image scale to the size of the window so it keeps its proportions? The site looks ok on a desktop browser, but on iPad or iPhone the header does not fit to screen.

    IntendtoInspire

    #102457
    Paulie_D
    Member

    The best way is not to put the image in the header but rather to set it as the background image of your header in your CSS. You can then tweak the CSS with media queries.

    #102461
    brent_james
    Member

    Got it. Thanks Paulie_D

    #102464
    snillor
    Member

    Or you could keep the image in the markup (often done if it’s a logo that links to the HOME page) and style it to occupy a percent of it’s containing element. I’m doing that on a redesign for my art league’s website.

    #header img { max-width: 80%; }

    The height automatically scales in proportion to the width. Of course, this won’t work in those older browsers that don’t understand max-width.

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