简体   繁体   中英

style.css is not picked up by index.php

I have an index.php html/php script and a style.css script in the same folder. Why does index.php not pick up the style.css script. Whatever changes I make to style.css have not effect on the browser when I put localhost/phplessons in the browser. Can someone please help? I much appreciate help on this.

chh1@chh1:/var/www/html/phplessons$ ls
calculator.php  index.php  style.css

index.php

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Title of the document</title>
    <link rel="stylesheet" type="text/css" href="style.css"/>
  </head>
  <body>

  <?php
    $dayofweek = date("w");
    switch ($dayofweek) {
      case 1:
        echo "It is Monday!";
        break;
        case 2:
          echo "It is Tuesday!";
          break;
          case 3:
            echo "It is Wednesday!";
            break;
            case 4:
              echo "It is Thursday!";
              break;
              case 5:
                echo "It is Friday!";
                break;
                case 6:
                  echo "It is Saturday!";
                  break;
                  case 0:
                    echo "It is Sunday!";
                    break;
    }
   ?>

  </body>
</html>

style.css

p {
  text-align: center;
  font-size: 120px;
  font-family: Arial;
  margin-top: 38vh;
  color: red;
}

The HTML file would be picking up the style.css, however the CSS is defining the <p></p> tag which is not being used in your HTML code.

Consider adding <p></p> around your echo statements.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM