Add CSS class to PHP Statement

You need to wrap it in an HTML element that has a class. Doing it with your code will require changes.

You can either do it outside the PHP, which will require changing where you open and close the PHP tags:

<?php } else { ?>
    <span class="classname">
        <?php esc_html_e('No results found','ThemeName'); ?>
    </span>
<?php } ?>

You can do it inside the PHP by concatenating a string, which means you’ll need to use esc_html__() instead of esc_html_e() (which echoes the result, which you shouldn’t do in the middle of a concatenation):

<?php 
} else {
    echo '<span class="classname">' . esc_html__('No results found','ThemeName') . '</span>';
}
?>

Or use printf() to put the string together, also using esc_html__():

<?php 
} else {
    printf( '<span class="classname">%s</span>', esc_html__( 'No results found', 'ThemeName' ) );
}
?>