How do you use CSS to place header tags just above a background image?

Discussion in 'CSS' started by infinityomega, Dec 8, 2006.

  1. #1
    This is the image by itself:


    [​IMG]


    Heres one that has been set up to display text just above it:

    [​IMG]

    I would like to know how to do the same thing.




    I put this in my css file (style.css)

    h6.background{
    background-image: url("images/volc_banner.gif");
    background-repeat: no-repeat;
    }


    Here is what put on my index page to test to see if it would work any:


    <h6 class="background">VOLCANOES OF THE NORTHWEST</h6>


    Thanks
     
    infinityomega, Dec 8, 2006 IP
  2. glorie

    glorie Peon

    Messages:
    123
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This might work:

    
    h6.background {
    background: url("images/volc_banner.gif") no-repeat top left;
    width: 417px;
    height: 62px;
    padding: 10px;
    }
    
    Code (markup):
    I based the width and height on the image you posted (volc_banner.gif).
     
    glorie, Dec 8, 2006 IP
  3. infinityomega

    infinityomega Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Nope :( the image doesnt appear but it does make an invisible space in the area. but the text does show up
     
    infinityomega, Dec 8, 2006 IP
  4. glorie

    glorie Peon

    Messages:
    123
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hmm, that code is completely working for me. I just tested it now (FF 2.0, and IE 6.0).

    Make sure the image is in the images folder
     
    glorie, Dec 8, 2006 IP
  5. glorie

    glorie Peon

    Messages:
    123
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    try using this code

    
    h6.background {
    background:#CCC url("images/volc_banner.gif") no-repeat top left;
    width: 417px;
    height: 62px;
    padding: 10px;
    }
    Code (markup):
    if you see a gray box background, then the image may not be in the proper place.
     
    glorie, Dec 8, 2006 IP
  6. infinityomega

    infinityomega Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The image is in there, is it

    top left

    or

    top-left;
     
    infinityomega, Dec 8, 2006 IP
  7. infinityomega

    infinityomega Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    maybe its because im using I.E 7.0
     
    infinityomega, Dec 8, 2006 IP
  8. infinityomega

    infinityomega Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Ahhh there is a gray box.. Oh boy...
     
    infinityomega, Dec 8, 2006 IP
  9. infinityomega

    infinityomega Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yay! Thanks glorie for setting me on the right track!

    For any one that has the same problem. I found a solution. All I needed to do was put ' ../ ' infront of "images/volc_banner.gif") as I was working in another folder (called style.ccs) so by putting ../ it tells the CSS to go outside of the folder of the file your working in and into another one. I'm glad that I am learning by hand-coding with only notepad :). Oh heres the code:

    h6.background {
    background: url("../images/volc_banner.gif") no-repeat top left;
    width: 417px;
    height: 62px;
    padding: 10px;
    }
     
    infinityomega, Dec 8, 2006 IP