Jump to content

Display bar


dreamwest

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.