Jump to content


Backround gets larger with text. How to?

  • Please log in to reply
2 replies to this topic

#1 cameeob2003

  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 01 July 2006 - 01:42 PM

I was not sure if this is the place to post this question. If not please forgive me. I am looking for a way to have the backround image or in my case an image that is inside of the <div></div> paramiters that stays the same length as the text you display on it from the mysql database. Im not sure how to explain this except throught the following link.


If you look at the news posts on the main page they are different sizes according to how much text you wish to display. I was wondering how they do this the same is witha forum system it encases the text in an the backround image as large as the text you wish to display sometimes a bit larger (for image as in my link ect...). Any help would be great or even a link as to how to do this. Thank you in advance. And again sorry if this was a incorrect post.

#2 Gast

  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts
  • LocationSouth East England

Posted 03 July 2006 - 09:11 PM

I assume this is fixed now as I couldnt see anything wrong?
OS and Internet Specs:
Windows XP (with SP2), 1680x1050, PHP 4, MySQL 3, Internet Explorer 6 &7 /FireFox 2.0/Opera 9.2

Simple Introduction to AJAX and XMLHttpRequest
Creating Live Data with AJAX Making a Google Suggest like application

#3 just-j

  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts

Posted 10 July 2006 - 02:10 PM

i didnt see anything wrong either..   but maby set a $var with your text that you wanna input over the background and then do a strlen($var)  then some simple math to convert the strlen($var) to fit the width of the pixels in the background img. for the height, considering where the wrap around is...  if the word wraps at 15 characters the do strlen($var) / 15 to get how many lines of text it will evaluate to and hack away at it untill you get the, img height pixel conversion, depending on the font size of the text..   but thats the php way to do it..  i guess strlen() is the same for javascripting??

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users