Skip to content

Instantly share code, notes, and snippets.

@pchatterjee
Last active February 15, 2023 01:02
Show Gist options
  • Select an option

  • Save pchatterjee/0764e4aa12e89fd4190fc1f9a5c2ddd8 to your computer and use it in GitHub Desktop.

Select an option

Save pchatterjee/0764e4aa12e89fd4190fc1f9a5c2ddd8 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
<style>
h3 {
font: normal 20px Tahoma, sans-serif;
}
table {
border: solid 1px #DDEEEE;
border-collapse: collapse;
border-spacing: 0;
font: normal 14px Arial, sans-serif;
}
table thead th {
background-color: #DDEFEF;
border: solid 1px #DDEEEE;
color: #336B6B;
padding: 10px;
text-align: left;
}
table tbody td {
border: solid 1px #DDEEEE;
color: #333;
padding: 10px;
}
</style>
<title>Crayola Colours</title>
</head>
<body>
<h3>Crayola Colours</h3>
<table>
<thead>
<tr>
<th>name &amp; colour</th>
<th>hex code</th>
</tr>
</thead>
<tbody>
<?php
$file = fopen("crayola.csv","r");
while ($data = fgetcsv($file)) {
echo '<tr>';
echo '<td style="background-color: ' . $data[1] . '; color:white;">' . $data[0] . '</td>';
echo '<td>'.$data[1].'</td>';
echo '</tr>';
}
fclose($file);
?>
</tbody>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment