/    Sign up×
Community /Pin to ProfileBookmark

Dynamically calculate padding-left

Hi,

Here’s a sample division:

[CODE]<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>[/CODE]

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!

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@cootheadApr 17.2011 — [indent]

possible solution here...
[list]
  • [*]http://www.dynamicdrive.com/forums/showpost.php?p=251462&postcount=2
  • [/list]

    [i]coothead[/i]

    [/indent]
    ×

    Success!

    Help @Rain_Lover spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 10.12,
    social: @webDeveloperHQ,
    });

    legal: ({
    terms: of use,
    privacy: policy
    analytics: Fullres
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @aldoushuxley,
    tipped: article
    amount: 1000 SATS,

    tipper: Anonymous,
    tipped: article
    amount: 1000 SATS,

    tipper: @linalla,
    tipped: article
    amount: 1000 SATS,
    )...