Search code examples
phpechonumber-formatting

styling with numbers for number formats using css


when using the number_format is it possible to customize the font or size found sites that say you cant but just want to double check ?

$em = mysqli_query($con, "SELECT * FROM `users`"); 
if(mysqli_num_rows($em) > 0){     
   while($row = mysqli_fetch_array($em)){
      $amount = $row['amount'];
      echo number_format($amount, 0);
   }
}

Solution

  • just use a CSS class for it or use inline style like this, here is the example:

      while($row = mysqli_fetch_array($em)){
    
            $amount = $row['amount'];
        
            $formated_number = number_format($amount, 0);
    
            echo '<span style="color:#000000;font-weight:bold;font-size:24px;">'.$formated_number.'</span>'
             }