<div style="padding:0 0 0 30px; background:url(http://www.google.com/help/hc/images/sidewiki_157505_comment_bubble.gif) left center no-repeat;">some text</div>
I wonder how I can calculate the padding-left:30px dynamically so that any icon I choose the padding-left value changes according to the image width.
Any help is appreciated!
JAB Creations
5:50 pm on Apr 17, 2011 (gmt 0)
It seems like you're trying to create a padding that is the width of the image...however using XHTML or CSS this can't be done without adding another XHTML element, such as a left-floating divisible element. You could technically use PHP to fetch the image and read it's width though that would be a total waste of your server's resources. So I'd go with using the left-floating divisible element inside of this divisible element though before the text.