PHP

用css js写的一个404页面模板

字号+ 编辑: 国内TP粉 修订: 种花家 来源: ThinkPHP 2023-09-15 我要说两句(0)

简洁大气的404页面,代码简洁。

如果是thinkphp框架, 先配置config.php 404地址

'TMPL_EXCEPTION_FILE' => './Application/Home/View/Public/404.html'

CSS代码

html {
    background: #f7f7f7;
}
body {
    background: #fff;
    color: #333;
    font-family: "MicrosoftYaHei" , "微软雅黑" ,Verdana,Arial;
    margin: 2em auto 0 auto;
    width: 700px;
    padding: 1em 2em;
    -moz-border-radius: 11px;
    -khtml-border-radius: 11px;
    -webkit-border-radius: 11px;
    border-radius: 11px;
    border: 1px solid #dfdfdf;
}
a {
    color: #2583ad;
    text-decoration: none;
}
a:hover {
    color: #d54e21;
}
h1 {
    border-bottom: 1px solid #dadada;
    clear: both;
    color: #666;
    margin: 5px 0 5px 0;
    padding: 0;
    padding-bottom: 1px;
    text-align: center;
}
h2 {
    text-align: center;
    font-size: 30px;
}
p {
    text-align: center;
    font-size: 18px;
}
div {
    margin-bottom: 80px;
}
ul {
    width: 400px;
    margin: 0 auto;
}

JS代码

function seconds_back() {
    if (all <= 0) {
        self.location = "http://www.sucaihuo.com";
    }
    var obj = document.getElementById("seconds_back");
    if (obj) obj.innerHTML = all + " 秒后";
    all--;
}
var all = 9;
if (all > 0) window.setInterval("seconds_back();", 1000);

HTML代码

<html>
 <head></head>
 <body>
  <h1 id="logo"> <a href="http://www.素材火.com"><img alt="素材火logo" src="http://localhost/sucai/Public/images/logo.jpg" /></a> </h1> 
  <h2> <img src="http://www.素材火.com/Public/images/err404.gif" alt="404错误" /> Hey? 404 </h2> 
  <p>抱歉,你输入的网址可能不正确,或者该网页不存在。</p> 
  <div> 
   <ul> 
    <li><a href="http://www.素材火.com"><span id="seconds_back"></span>返回首页</a></li> 
   </ul> 
  </div>
 </body>
</html>

阅完此文,您的感想如何?
  • 有用

    0

  • 没用

    0

  • 开心

    0

  • 愤怒

    0

  • 可怜

    0

1.如文章侵犯了您的版权,请发邮件通知本站,该文章将在24小时内删除;
2.本站标注原创的文章,转发时烦请注明来源;
3.交流群: PHP+JS聊天群

相关课文
  • mac开发接入微信公众号接口返回报错 cURL error 56: SSLRead() return error -9806

  • pecl安装程序时报错Array and string offset access syntax with curly braces is no longer supported

  • PHP的换行符是什么

  • 由于商家传入的H5交易参数有误,该笔交易暂时无法完成,请联系商家解决

我要说说
网上宾友点评