Forums

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

Home Forums CSS can you assign image as background image for div?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31149
    redhare
    Member

    i’m trying to achieve this.. on the top right.. using the compass as a background and the social buttons over the bottom of the compass image..

    the image

    here is what the site currently looks like..

    Your text to link…

    what would be the best method to achieve this?

    #67739
    TheDoc
    Member

    Yes… Sort of hard to explain because it’s quite basic.

    To use an image as a background on a div, the CSS will go like this:

    #divname {
    background: url('path/to/image.jpg');
    }

    That is its most basic form, you can also position it, say if you’d like it to repeat or not, and even add a color behind the image.

    Example:

    #divname {
    background: url('path/to/image.jpg') top left no-repeat #fff;
    }
    #67666
    redhare
    Member

    this is what i have for the stylesheet but the background image still does not come up..

    #top-side-bar {
    background-image:url('/images/compass.jpg');
    background-repeat:no-repeat;
    width: 300px;
    }

    here is the code i have fo rthe sidebar..

    	
    #67667
    TheDoc
    Member

    If you update the link to the site in question I can have a closer look at it.

    Are you 100% sure that’s where the image is located?

    #67668
    redhare
    Member

    so, i figured it out.

    i put some padding to make the div box bigger then used a vertical align to push the social buttons to the bottom. from there.. i used the padding to move em to the right..

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