最近有幾個讀者私信我說,期末有個大作業要實作一個靜態網站,肝了幾百行代碼,手把手帶你實作一個游戲靜態網站,
先上兩張效果圖


這個網站適合初學者練手
技術點: html + css
難度系數:無
- HTML 代碼
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>《風暴英雄》官方網站_暴雪出品 明星匯聚 MOBA競技新篇章</title>
<!--
1.幾乎所有的網站的快捷圖示(收藏圖示)都叫做favicon.ico
2.快捷圖示(收藏圖示)必須要放到站點檔案夾的根目錄中
3.通過link標簽引入快捷圖示(收藏圖示)
-->
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<!--
reset.css: 很暴力的清除系統默認設定的樣式
normalize.css: 會保留系統默認設定的有價值的樣式, 并且修復了很多瀏覽器的BUG
-->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="font/iconfont.css">
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/index.css">
</head>
<body>
<div class="header">
<h1><a href="#"><img src="images/logo.png" alt=""></a></h1>
<ul>
<li><a href="#">進入官網</a></li>
<li><a href="#">注冊賬號</a></li>
<li><a href="#">游戲特色</a></li>
<li><a href="#">游戲下載</a></li>
</ul>
</div>
<div class="main">
<div class="slogan">
<img src="images/slogan.png" alt="">
</div>
<ul class="list">
<li>
<h3>顛覆傳統 MOBA 2.0</h3>
<a href="#">
<img src="images/eye1.jpg" alt="">
</a>
</li>
<li>
<h3>2019年第1賽季</h3>
<a href="#">
<img src="images/eye2.jpg" alt="">
</a>
</li>
<li>
<h3>2019黃金風暴聯賽報名</h3>
<a href="#">
<img src="images/eye3.jpg" alt="">
</a>
</li>
</ul>
</div>
<div class="footer">
<div class="footer-in">
<div class="footer-top clearfix">
<p class="fl">
<a href="#">
<i></i>
在線客服
</a>
<a href="#">
<i></i>
反饋
</a>
<a href="#">
<i></i>
加入我們
</a>
</p>
<p class="fr">
<span>合作品牌</span>
<i></i>
<b class="iconfont icon-jiahao"></b>
<span>|</span>
<b class="iconfont icon-sanjiaodown"></b>
</p>
</div>
<div class="footer-middle clearfix">
<div class="fl middle-left">
<img src="images/blizzard.png" alt="">
<img src="images/163.png" alt="">
</div>
<div class="fl middle-right">
<p>
<a href="#">隱私</a>
<span>|</span>
<a href="#">法律條款</a>
<span>|</span>
<a href="#">API</a>
</p>
<div>
<p>
?2019 暴雪娛樂有限公司著作權所有 由上海網之易網路科技發展有限公司運營 <a href="#">著作權侵權</a> | 新廣出審[2014]1356號
</p>
<p>
文網進字[2014]0115號 | <a href="#">滬網文號〔2017〕9633-727號</a> | <a href="#">增值電信業務經營許可證編號:滬B2-20080012</a>
</p>
<p>
互聯網違法和不良資訊舉報電話:0571-28090163 滬公網安備 31011502022167號 | <a href="#">上海市網路游戲行業自律公約</a>
</p>
<p>
<img src="images/footer1.png" alt="">
<img src="images/footer2.png" alt="">
<img src="images/footer3.png" alt="">
<img src="images/footer4.png" alt="">
<img src="images/footer5.png" alt="">
| 適齡提示:適合18歲及以上使用
<a href="#">家長監護工程></a>
</p>
</div>
</div>
</div>
<div class="footer-bottom">
<p>積極健康的游戲心態是健康游戲的開端,本游戲故事情節設定緊湊,請您合理控制游戲時間,避免沉溺游戲影響生活,注意自我保護,防范網路陷阱,</p>
<p>健康游戲忠告:抵制不良游戲,拒絕盜版游戲,注意自我保護,謹防受騙上當,適度游戲益腦,沉迷游戲傷身,合理安排時間,享受健康生活,</p>
</div>
</div>
</div>
<video autoplay loop muted poster="images/bg.jpg">
<source src="images/bg.mp4" type="video/mp4">
<source src="images/bg.webm" type="video/webm">
</video>
</body>
</html>
- css 樣式代碼
/*背景開始*/
video{
width: 100%;
height: 1080px;
object-fit: cover;
background: red;
}
/*背景結束*/
/*頭部開始*/
.header{
width: 1196px;
position: absolute;
left: 50%;
transform: translateX(-50%);
z-index: 999;
}
.header>ul{
margin: 0;
padding: 0;
padding-top: 45px;
list-style: none;
}
.header>ul>li{
float: left;
width: 200px;
height: 60px;
line-height: 60px;
text-align: center;
background: linear-gradient(to bottom, #46018c, #0200a1);
border-right: 1px solid rgba(255,255,255,0.2);
box-sizing: border-box;
}
.header>ul>li:nth-child(2){
margin-right: 393px;
border-right: none;
}
.header>ul>li:last-child{
border-right: none;
background: url("./../images/download2.0.png") no-repeat;
}
.header>ul>li:last-child a{
background: none;
}
.header>ul>li>a{
display: inline-block;
width: 100%;
height: 100%;
font-size: 18px;
color: #fff;
text-decoration: none;
background: url("./../images/nav-itembg.png");
border-bottom: 2px solid transparent;
box-sizing: border-box;
transition: border-color 0.5s;
}
.header>ul>li>a:hover{
border-color: #fff;
}
.header>h1{
margin: 0;
padding: 0;
position: absolute;
left: 50%;
top: 0;
transform: translateX(-50%);
}
.header>h1 img{
width: 393px;
}
/*頭部結束*/
/*內容開始*/
.main{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 1080px;
/*background: skyblue;*/
}
.main>.slogan{
position: absolute;
left: 50%;
top: 235px;
transform: translateX(-50%);
}
.main>.list{
margin: 0;
padding: 0;
list-style: none;
width: 1010px;
display: flex;
justify-content: space-between;
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
z-index: 888;
}
.main>.list>li{
width: 310px;
height: 205px;
background: skyblue;
position: relative;
}
.main>.list>li:nth-child(1){
/*margin-bottom: 120px;*/
/*bottom: 120px;*/
animation: move 1s linear 1s normal;
animation-fill-mode: forwards;
}
.main>.list>li:nth-child(2){
animation: move 1s linear 2s normal forwards;
}
.main>.list>li:nth-child(3){
animation: move 1s linear 3s normal forwards;
}
@keyframes move {
from{
bottom: 0;
}
to{
bottom: 120px;
}
}
.main>.list>li>h3{
margin: 0;
padding: 0;
width: 100%;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 20px;
color: #fff;
background: #15112d;
border: 2px solid #2a2658;
box-sizing: border-box;
}
.main>.list>li>a{
display: inline-block;
width: 100%;
border: 2px solid #655fc7;
box-sizing: border-box;
}
.main>.list>li>a>img{
width: 100%;
vertical-align: bottom;
}
/*內容結束*/
/*底部開始*/
.footer{
width: 100%;
height: 502px;
background: #0d0017;
position: absolute;
top: 1080px;
left: 0;
border-top: 2px solid #655fc7;
}
.footer>.footer-in{
width: 1000px;
height: 422px;
margin: 0 auto;
}
.footer-in>.footer-top{
padding-top: 125px;
padding-bottom: 45px;
}
.footer-in>.footer-top a{
display: inline-block;
text-decoration: none;
font-size: 14px;
color: #fff;
margin-right: 10px;
}
.footer-in>.footer-top a>i{
display: inline-block;
width: 19px;
height: 19px;
background: url("./../images/footer-top.png") no-repeat;
background-position: -6px -7px;
margin-right: 10px;
vertical-align: middle;
}
.footer-in>.footer-top a:nth-child(2) i{
background-position: -36px -8px;
}
.footer-in>.footer-top a:nth-child(3) i{
background-position: -6px -100px;
}
.footer-in>.footer-top span{
font-size: 14px;
color: #fff;
margin: 0 10px;
}
.footer-in>.footer-top i{
display: inline-block;
width: 95px;
height: 26px;
background: url("./../images/footer-top.png") no-repeat;
background-position: -142px -44px;
vertical-align: top;
}
.footer-in>.footer-top b{
display: inline-block;
width: 14px;
height: 14px;
line-height: 14px;
text-align: center;
font-size: 12px;
color: #fff;
background: #2b0473;
border: 1px solid #462385;
}
.footer-in>.footer-top p{
height: 30px;
line-height: 30px;
}
.footer-in>.footer-middle>.middle-left{
/*注意點: 在企業開發中, 如果元素是左浮動的, 就不要設定左邊的margin*/
margin-right: 75px;
}
.footer-in>.footer-middle>.middle-right{
font-size: 14px;
}
.footer-in>.footer-middle>.middle-right a{
text-decoration: none;
color: #ccc;
}
.footer-in>.footer-middle>.middle-right a:hover{
color: #fff;
}
.footer-in>.footer-middle>.middle-right span{
color: #ccc;
margin: 0 10px;
}
.footer-in>.footer-middle>.middle-right>div p{
font-size: 12px;
color: #8eb1bc;
}
.footer-in>.footer-middle>.middle-right>div a{
color: #8eb1bc;
}
.footer-in>.footer-bottom{
padding-top: 35px;
}
.footer-in>.footer-bottom>p{
font-size: 12px;
color: #417aa1;
line-height: 10px;
text-align: center;
}
/*底部結束*/
- 以上就是核心代碼,基本沒有任何難度,就是個靜態網頁實戰,
最后,點贊,在看,關注,評論,四連支持,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/287008.html
標籤:其他
上一篇:c語言精選試題----陣列
