BG images

Discussion in 'HTML & Website Design' started by velocity834, Jun 22, 2006.

  1. #1
    How do i set the background of a cell in a table to an image?
     
    velocity834, Jun 22, 2006 IP
  2. sgtsloth

    sgtsloth Peon

    Messages:
    205
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do this with css:

    <td class="tdWithBG">Stuff</td>

    In your css file:

    
    .tdWithBG
    {
         background: url(images/image.jpg);
    }
    
    Code (markup):
    Off the top of my head, but that should work.
     
    sgtsloth, Jun 22, 2006 IP
  3. hubdigital

    hubdigital Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    or you can use good 'ol table bg elements.

    <td background="url">

    Andrew
     
    hubdigital, Jun 23, 2006 IP
  4. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hello, velocity834.

    The CSS background-image property (that can be shortened to background) is part of a group of assorted properties.

    The background-image property sets the background image of an element. For example:

    BODY { background-image: URL(/images/foo.gif) }

    The background-repeat property determines how a specified background image is repeated. For instance, the "repeat-x" value repeats the image horizontally, while the "repeat-y" value repeats the image vertically.

    The background-attachment property determines if a specified background image will scroll with the content or be fixed with regard to the canvas. If you want to specify a fixed background image:

    background-attachment: fixed;

    The background-position property gives the initial position of a specified background image: left, center, right, top, center, bottom.
     
    TechnoGeek, Jun 25, 2006 IP
  5. vtechno42

    vtechno42 Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you work how I work with templates, and you just need to have a different background on multiple cells, but don't want to complicate the CSS file with a number of short classes or IDs, do it like this:

    <td style="background-image: url('image.jpg');">
    HTML:
     
    vtechno42, Jun 29, 2006 IP