No-Repeat Within a WordPress Page

Discussion in 'HTML & Website Design' started by tankard, Feb 2, 2009.

  1. #1
    Hi,

    I need to embed a simple table within a WordPress post (a page). I know it's not a good idea, but this time I really need to.

    Wanted to use a background image for one table cell but I cannot get the no-repeat attribute to work. I've tried both out-dated HTML and CSS but the background image is still cloned and copied. Tried to use DIV... doesn't work. Why is this thing so stubborn? Any ideas?
     
    tankard, Feb 2, 2009 IP
  2. katendarcy

    katendarcy Peon

    Messages:
    115
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you post the code you're using to display the background image?

    Basically it should be something like:
    {background:url('myimage.jpg') no-repeat;}

    Is that what you've tried?
     
    katendarcy, Feb 2, 2009 IP
  3. tankard

    tankard Well-Known Member

    Messages:
    1,018
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    185
    #3
    Thank you for your reply. Actually, I've ended up with this
    <td style="background-image: url('http://www.lol.com/review-bckgr.gif'); top left background-repeat: no-repeat;">
    Code (markup):
    I have also tried to set a class for a TD and get it all into the stylesheet but it doesn't make any difference.
     
    tankard, Feb 2, 2009 IP
  4. katendarcy

    katendarcy Peon

    Messages:
    115
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try this:
    Take off "-image" and just use a general background style. Also, take out "background-repeat" and switch the repeat declaration with the position. You should end up with:
    <td style="background: url('http://www.lol.com/review-bckgr.gif') no-repeat top left;">
     
    katendarcy, Feb 2, 2009 IP
  5. tankard

    tankard Well-Known Member

    Messages:
    1,018
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    185
    #5
    Mmh, no, it doesn't display any background at all, and besides if you remove the semi, you won't get it working on a Safari (not that I'm too bothered, though). Looks like I'd have to go without the background. I suspect it has something to do with my theme. Either there's a stray DIV or there's a parent element that keeps the background cloning.
     
    tankard, Feb 2, 2009 IP
  6. katendarcy

    katendarcy Peon

    Messages:
    115
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hmmm... Did you see my edit? I missed a couple things so I re-did my post. (Sorry!)

    Let me know if you try the new code. : )
     
    katendarcy, Feb 2, 2009 IP
  7. katendarcy

    katendarcy Peon

    Messages:
    115
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Basically, it looks like you're combining a couple types of style here. (Maybe as a result of the different things you were trying?) There's the background-image style, which takes the file path as a value. The background-position, and also the background-repeat. But, in order to use them together you need to just use the background style. (See the code from two posts ago.) Or, list them seperately, such as:

    <td style="background-image: url('http://www.lol.com/review-bckgr.gif');background-position: top left; background-repeat: no-repeat;">

    (Hope that made sense.)
     
    katendarcy, Feb 2, 2009 IP