Jump to content

Recommended Posts

I wanted to have an image repeat to a certain width based on an input:

 

$input = 30;

echo "<div width=\"100px\" style=\"background: url(http://img.site.com/bar.gif) left repeat {$input}px\"></div>";

 

So the the input of 30 should fill the div 30% because the div has a width of 100px. Im not sure about how to set a background to repeat by a certain width

Link to comment
https://forums.phpfreaks.com/topic/162863-display-bar/
Share on other sites

Ive done it!

 

Took me a few hours to work it out. A div parent with a background image and  a image content

 

$with = 150;

echo "<div width=\"320px\" style=\"height:20px; background: url(http://img.site.com/progress_bar_white.gif) top;\" >
    <img border=\"0\" src=\"http://img.site.com/progress_bar_blue.gif\" width=\"".$width."\" height=\"20\" align=\"left\"></div>";

 

I feel so spcial ;D

Link to comment
https://forums.phpfreaks.com/topic/162863-display-bar/#findComment-859467
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.