制作一個簡單的HTML5靜態網頁需要使用HTML、CSS和JavaScript等技術。以下是一個基本的HTML5網頁制作代碼模板,包括了網頁的基本結構和一些簡單的樣式設置。

HTML5網頁制作代碼模板
html
<!DOCTYPE html>
<html lang=”zh-CN”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>我的第一個HTML5網頁</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
header {
background: #50b3a2;
color: white;
padding-top: 30px;
min-height: 70px;
border-bottom: #e8491d 3px solid;
}
header a {
color: #ffffff;
text-decoration: none;
text-transform: uppercase;
font-size: 16px;
}
header ul {
padding: 0;
list-style: none;
}
header li {
display: inline;
padding: 0 20px 0 20px;
}
header #branding {
float: left;
}
header #branding h1 {
margin: 0;
}
header nav {
float: right;
margin-top: 10px;
}
header .highlight, header .current a {
color: #e8491d;
font-weight: bold;
}
header a:hover {
color: #ffffff;
font-weight: bold;
}
.banner {
padding: 40px 0;
color: #ffffff;
background: url(‘banner-bg.jpg’) no-repeat 0px -400px;
background-size: cover;
}
.banner h1 {
margin: 0;
}
.main-col {
float: left;
width: 60%;
}
.sidebar {
float: right;
width: 30%;
background: #e8491d;
padding: 20px;
color: #ffffff;
}
.main-col article h2 {
color: #e8491d;
}
.main-col article p {
font-size: 18px;
line-height: 1.6em;
}
.clear-fix {
clear: both;
}
footer {
background: #878787;
color: #ffffff;
text-align: center;
padding: 30px 0;
}
</style>
</head>
<body>
<header>
<div class=”container”>
<div id=”branding”>
<h1><a href=”index.html”>我的網站</a></h1>
</div>
<nav>
<ul>
<li class=”current”><a href=”index.html”>首頁</a></li>
<li><a href=”about.html”>關于我們</a></li>
<li><a href=”services.html”>服務</a></li>
</ul>
</nav>
</div>
</header>

<section class=”banner”>
<div class=”container”>
<h1>歡迎來到我的網站</h1>
<p>這是一個簡單的HTML5靜態網頁模板。</p>
</div>
</section>

<section class=”main-col”>
<div class=”container”>
<article id=”main-col”>
<h2 class=”page-title”>服務</h2>
<ul id=”services”>
<li>
<h3>網站設計</h3>
<p>我們提供專業的網站設計服務,幫助您的網站在競爭中脫穎而出。</p>
</li>
<li>
<h3>網站維護</h3>
<p>我們的維護服務確保您的網站始終保持最佳狀態。</p>
</li>
<li>
<h3>網站托管</h3>
<p>我們提供可靠的網站托管服務,確保您的網站始終在線。</p>
</li>
</ul>
</article>
</div>
</section>

<aside class=”sidebar”>
<div class=”dark”>
<h3>獲取報價</h3>
<form class=”quote”>
<div>
<label>姓名</label><br>
<input type=”text” placeholder=”姓名”>
</div>
<div>
<label>郵箱</label><br>
<input type=”email” placeholder=”郵箱”>
</div>
<div>
<label>消息</label><br>
<textarea placeholder=”留言”></textarea>
</div>
<button class=”button_1″ type=”submit”>發送</button>
</form>
</div>
</aside>

<div class=”clear-fix”></div>

<footer>
<p>版權所有 &copy; 2025 我的網站</p>
</footer>
</body>
</html>
代碼說明
DOCTYPE: 聲明文檔類型為HTML5.
html: 根元素,lang屬性指定頁面語言.
head: 包含文檔的元數據,如字符集聲明、視口設置、標題和樣式.
body: 包含網頁的可見內容.
header: 網頁的頭部區域,通常包含網站的標志和導航菜單.
section: 表示文檔中的一個獨立部分,如橫幅或主要內容區域.
article: 表示一個獨立的內容塊,如博客文章或新聞報道.
aside: 表示與頁面內容稍微相關的部分,如側邊欄.
footer: 網頁的底部區域,通常包含版權信息和其他鏈接.
樣式說明
body: 設置字體、邊距和背景顏色.
container: 設置頁面內容的寬度和居中對齊.
header: 設置頭部的背景顏色、文字顏色和邊框.
banner: 設置橫幅的背景圖片和文字顏色.
main-col: 設置主要內容區域的寬度.
sidebar: 設置側邊欄的寬度、背景顏色和文字顏色.
footer: 設置頁腳的背景顏色和文字顏色.
這個模板提供了一個基本的HTML5網頁結構和樣式,你可以根據需要進一步擴展和自定義內容和樣式.