php with css

Discussion in 'Programming/Scripts' started by complete, Dec 10, 2015.

  1. complete

    complete New Member

    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.
     
  2. sjau

    sjau Local Meanie Moderator

    not really sure what you mean. css files are just linked in the header section of html files.
     
  3. vsolmyr

    vsolmyr New Member

    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>
     
  4. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    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 :D
     
    paolo2 likes this.
  5. danny94

    danny94 New Member

    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.
     
    paolo2 likes this.
  6. ifour.parth

    ifour.parth New Member

    <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>
     

Share This Page