How do I use CSS with PHP? I have tried to do this according to examples I found by searching online. But nothing worked. Please help.
Do you use a framework? sjau is right: Code: <html> <head> <!--CSS goes here--> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> hi </body> </html>
Maybe it would be helpful to know what you wanted to achieve? Which example did you use? What is your goal? Edit: @vsolmyr lulz this is a rather old thread
Import/ incluse css files into php page. include'CSS/main.css'; OR if you have a php file and like to output style lines, just use echo.
<html> <head> <title>...</title> <style type="text/css"> table { margin: 8px; } th { font-family: Arial, Helvetica, sans-serif; font-size: .7em; background: #666; color: #FFF; padding: 2px 6px; border-collapse: separate; border: 1px solid #000; } td { font-family: Arial, Helvetica, sans-serif; font-size: .7em; border: 1px solid #DDD; } </style> </head> <body> <?php> echo "<table>"; echo "<tr><th>ID</th><th>hashtag</th></tr>"; while($row = mysql_fetch_row($result)) { echo "<tr onmouseover=\"hilite(this)\" onmouseout=\"lowlite(this)\"><td>$row[0]</td> <td>$row[1]</td></tr>\n"; } echo "</table>"; ?> </body> </html>