Writing over top of background image...

Discussion in 'CSS' started by NewComputer, Oct 9, 2004.

  1. #1
    I have the following html code

    <td background="images/test.jpg" width="567" height="22"></td>

    Now, the background image has an arrow about 22 pixels in from the left. I want the text to start after the arrow. I tired this

    <td background="images/welcome.jpg" width="567" height="22">Welcome to blah blah blah</td>

    and obviously it defaults to the left. I can center it, but then it does not sit right in relation to the arrow. I can use the &nbsp; repetatively to make it align. If I indent, it puts a little dot.

    Any ideas?
     
    NewComputer, Oct 9, 2004 IP
  2. Dji-man

    Dji-man Peon

    Messages:
    185
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try :
    <td background="images/welcome.jpg" width="567" height="22"><h1>Welcome to blah blah blah</h1></td>

    and in css :
    h1 {
    margin-left: 25px;
    }
     
    Dji-man, Oct 9, 2004 IP
  3. mopacfan

    mopacfan Peon

    Messages:
    3,273
    Likes Received:
    164
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or you can use a clear, 1px gif, set it's size to be 22px wide and aligned left (you may need to do some tweaking) and it should do the trick. The css won't render the same on everyone's screen. I love css, don't ge me wrong, it's just not foolproof. :(
     
    mopacfan, Oct 9, 2004 IP
  4. NewComputer

    NewComputer Well-Known Member

    Messages:
    2,021
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    188
    #4
    It's wierd, I thought there would be an 'indent' option or something. The css way does not work because of a few browsers that I have checked. The transparent gif is the same as the &nbsp; no? I know I have to put about 7 or 8, but the gif is another image to load. I guess there is alt text there too. So much work for such a simple thing.
     
    NewComputer, Oct 9, 2004 IP
  5. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #5
    Try this:

    <td background="images/welcome.jpg" width="567" height="22" style="padding-left:26px">Welcome to blah blah blah</td>

    Where it says 26px put whatever number you want.
     
    Colleen, Oct 9, 2004 IP
    minstrel likes this.
  6. mushroom

    mushroom Peon

    Messages:
    369
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I would have done it by not putting the arrow on the background and loading it as a gif making it easyer to postion.
     
    mushroom, Oct 9, 2004 IP
  7. NewComputer

    NewComputer Well-Known Member

    Messages:
    2,021
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    188
    #7
    Awesome Kalina, that is exactly what I was looking for. Thanks again.
     
    NewComputer, Oct 9, 2004 IP
  8. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #8
    Great, you're welcome NewComputer! :D
     
    Colleen, Oct 9, 2004 IP
  9. saurabh.vaastav

    saurabh.vaastav Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hi,I tried the option it does help me with writing text on the image but at the same time it displays the image more than once even if i give only one .I want the image to be displayed only once.Please let me know if you have any suggestions.Thanks
     
    saurabh.vaastav, Apr 16, 2012 IP
  10. GetConversion

    GetConversion Member

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #10
    Try this:

    
    <td background="images/welcome.jpg" width="567" height="22" style="padding-left:26px; background-repeat:no-repeat;">Welcome to blah blah blah</td>
    
    Code (markup):
     
    GetConversion, Apr 17, 2012 IP