What are some best practices for styling MySQL data output in tooltips using CSS in PHP?

When displaying MySQL data in tooltips using CSS in PHP, it is important to style the output in a visually appealing way to enhance user experience. To achieve this, you can use CSS to customize the appearance of the tooltips, such as changing the font size, color, background color, and border. By applying proper styling techniques, you can make the tooltips more attractive and easier to read for users.

<?php
// Assuming $data contains the MySQL data to be displayed in tooltips
echo "<div class='tooltip'>";
echo "<span class='tooltiptext'>$data</span>";
echo "</div>";
?>

<style>
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
}
</style>