Hide a div when tags doesnt exist [duplicate]

You need to first get and check if there are any tags available, so something like this

<?php if (get_tags()) : ?>
<div class="etichete">
    <p><?php the_tags(); ?></p>
</div>
<?php endif; ?>

You can also use !empty(get_tags()) but because if no tags are available it will return an empty array and an empty array is considered falsy, it will not pass the condition and would not display the etichete div.

So in this case if (!empty(get_tags)) and if (get_tags()) will work the same way.

tech