dreamwest Posted June 19, 2009 Share Posted June 19, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/162863-display-bar/ Share on other sites More sharing options...
departedmind Posted June 19, 2009 Share Posted June 19, 2009 div tag does not have width attribute so div wont have 100px width, for css background positions check this http://www.w3schools.com/css/pr_background-position.asp Quote Link to comment https://forums.phpfreaks.com/topic/162863-display-bar/#findComment-859424 Share on other sites More sharing options...
haku Posted June 19, 2009 Share Posted June 19, 2009 You also can't limit the width of a repeated background image. Quote Link to comment https://forums.phpfreaks.com/topic/162863-display-bar/#findComment-859426 Share on other sites More sharing options...
dreamwest Posted June 19, 2009 Author Share Posted June 19, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/162863-display-bar/#findComment-859467 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.