get the avatar url instead of an html img tag when using get_avatar?

It’s fairly simple to construct the Gravatar URL yourself, it’s just an MD5 hash of the user’s email address.

<?php $gravatar="http://www.gravatar.com/avatar/" . md5(strtolower($email)) . '&s=32'; ?>

<div class="avatar" style="background: url(<?php echo $gravatar ?>);" ></div>

The s parameter at the end there defines the size of the image in pixels.

Using GravatarsWordPress Codex