查看相關知識
查看相關練習
要求:
經常輸入資源名稱錯誤時,會出現界面找不到的情況,很不友好,撰寫一個404界面找不到時的顯示界面

實作步驟:
創建動態的 Java Web 項 目
在 WebContent 目錄內,創建 HTML5 檔案“404.html”,撰寫界面代碼
配置 Eclipse 的 Tomcat 服務器,并部署專案“Java_web_01”,啟動 Tomcat 服務器
在瀏覽器地址欄輸入界面訪問URL,測驗是否能正常訪問
404.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>網頁訪問不了</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
box-sizing: 0;
}
body{
background-color: #ededef;
font-family: "楷體";
}
#warp{
padding: 200px 0px;
display: flex;
justify-content: center;
}
.left{
padding: 150px;
background: url(img/bg.jpg) no-repeat;
background-size: 80% 80%;
background-position: right;
}
.left_img{
text-align: right;
float: left;
background: url(img/bg.jpg) no-repeat;
}
.right{
line-height: 30px;
margin: auto 50px;
}
.right h3{
}
.reason,.oper{
margin-top: 20px;
}
</style>
</head>
<body>
<div id="warp">
<div class="left">
<div class="left_img"></div>
</div>
<div class="right">
<h3 class="title">啊哦,你所訪問的頁面不存在,可能是炸了</h3>
<div class="reason">
<p>可能的原因:</p>
<p>1、手抖打錯了</p>
<p>2、鏈接過了保質期</p>
</div>
<div class="oper">
<p><a href="javascript:histor.go(-1)">回傳上一級頁面</a></p>
<p><a href="#">回到網站首頁</a></p>
</div>
</div>
</div>
</body>
</html>
源代碼:點擊查看
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/263319.html
標籤:其他
