php include 引入 html 文件套接生成页面

index.php 前端套接页面

<?php
include "header.php";
include "body.php";
include "footer.php"
?>

header.php 头部页面

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title> 这是标题</title>
  <style type="text/css">
    html,body,th{
      font-family: sans-serif;
      font-size: 12px;
      font-weight: 400;
    }
    .myPHP{
      padding: 20px 0 10px 0;
    }
  </style>
</head>

body.php 主体页面

<body>
  <div class="myPHP">
    这是 body 部分
  </div>
</body>

footer.php 页脚页面

<footer>
  这是 footer 部分
</footer>

</html>

CSS 衔接区块 HTML 样式

指定 id
html:

<footer id="footer">...</footer>

css:

#footer {font-family: 'Helvetica Neue',Helvetica,'Lucida Grande',Arial,'Hiragino Sans GB','\5FAE\8F6F\96C5\9ED1','WenQuanYi Micro Hei',STHeiti,SimSun,sans-serif;}

 

指定 class
html:

<div class="copyright">...</div>

css:

.copyright{font-family: 'Helvetica Neue',Helvetica,'Lucida Grande',Arial,'Hiragino Sans GB','\5FAE\8F6F\96C5\9ED1','WenQuanYi Micro Hei',STHeiti,SimSun,sans-serif;}