<div class="avatar">'.CommunityQuizHelper::getUserAvatar($quiz->created_by, $config).'</div>
still shows as a tiny dot and takes a little space left of the hits number.
You need to bring this div inside the condition because there is no reason to show it if there is no avatar to show.
Like this
<?php echo ($config == '1') ? '<div class="avatar">'.CommunityQuizHelper::getUserAvatar($quiz->created_by, $config).'</div>' : '';?>

