SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    background image in a <td> tag?

    HOW?

    Why doesn't this work?

    Code:
    <td style=\"width: 98%; background-image: url(/images/middletop.png); background-repeat: repeat-x;\">blah</td>
    I would be extremely helpful for any advice!
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Link?

    Does your browser support the PNG format? Most do not.

    Have you tried looking at the spec for background? Make sure your code is correct.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    SitePoint Member Corey's Avatar
    Join Date
    Jul 2001
    Location
    US
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you have the \" \" in your code? Take those out and your code will work.
    Corey Breitfelder :: cbreits23@home.com
    xpiso internet solutions :: www.xpiso.com

  4. #4
    ComDude CryingWolf's Avatar
    Join Date
    Dec 2000
    Location
    I don't know the cat drug it in!!!
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The \" is used in php is this part of a php script???
    body { background:#000000; color:#000000 }
    HEY, WHO TURNED OUT THE LIGHTS?!?
    Easy come easy go!!!
    CryingWolf

  5. #5
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The code is indeed PHP. The \" are just to escape the quotes, so that PHP doesn't parse them. Anyway, looking at the CSS reference for background-image at w3schools, I cant see anything wrong with my code! This is how it's supposed to look:

    Code:
    body
    { 
    background-image: url(stars.gif); 
    background-color: #000000
    }
    Maybe it simply doesn't work to put backgrounds in cells? I may need some workaround.
    Last edited by M. Johansson; Jul 5, 2001 at 03:30.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  6. #6
    SitePoint Member Corey's Avatar
    Join Date
    Jul 2001
    Location
    US
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see (didn't realize you were doing this in php). However, it is valid to use a background image in a <td> cell (I use it on my site).

    Your code looks right, however, why don't you try putting the css into <style></style> tags in your header and calling that cell background color using a class. For example:

    <style type="text/css">
    .myCell {
    background-image: url(/images/middletop.png);
    background-repeat: repeat;
    }
    </style>

    <td class="myCell">whatever you want</td>

    I don't know why it doesn't work your way, but when I tested it out using both methods, only calling the background by class worked

    Hope this helps
    Corey Breitfelder :: cbreits23@home.com
    xpiso internet solutions :: www.xpiso.com

  7. #7
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Cory - it worked!

    I entered it into my external stylesheet, and it worked. How wierd. A bug in CSS, perhaps? Ah, no matter - the coding looks better with everything in a separate stylesheet anyway.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  8. #8
    SitePoint Member Corey's Avatar
    Join Date
    Jul 2001
    Location
    US
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, probably something to do with the way the browser renders the css. Glad to see it works (finally!)
    Corey Breitfelder :: cbreits23@home.com
    xpiso internet solutions :: www.xpiso.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •