Forums

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

Home Forums CSS [Solved] Getting a background image to 'fit'

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #184389
    Everton
    Participant

    Hello

    How would I get my background image to stretch as far as – but not over – the orange footer bar I have at the bottom of this page, please:

    Image question

    The site is ‘governed’ by my style-sheet, styles.css, which contains the reference to the image here:

    body{
            font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
            font-size: 13px;
            background-color:#E4E4E4;
            background-image:url(../images/bg.png); 
            background-position:left top;
            background-repeat:repeat-x;
            color:#3F3E3C;
            margin:0 0 1px; height:100%; 
            line-height: 1.5;
        }

    Thank you.

    #184390
    shaneisme
    Participant
    #184397
    Everton
    Participant

    Hello shaneisme

    Thank you for your reply and the link to here:

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

    Don’t those examples show how to fill the screen completely? I would just want mine to go as far as the orange bar:

    Image for CSS Tricks

    #184398
    shaneisme
    Participant

    It will fit whatever parent the background is set to.

    #184399
    Everton
    Participant

    I think I have got it now with this:

    background-image:url(../images/bg.png);
                    background-size: 80% 160%; 
            background-position:left top;
            background-repeat:repeat-x;

    Many thanks!

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