HTML5簡單網頁設計源代碼
HTML5是一種標準的超文本標記語言,用于網頁設計與開發。下面是一個HTML5簡單網頁的源代碼示例:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>My Website</h1>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section id="home">
<h2>Welcome to My Website!</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam odio nec elit accumsan ullamcorper. Aenean sagittis velit eget mi auctor, nec bibendum nunc euismod.</p>
</section>
<section id="about">
<h2>About Us</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam odio nec elit accumsan ullamcorper. Aenean sagittis velit eget mi auctor, nec bibendum nunc euismod.</p>
</section>
<section id="contact">
<h2>Contact Us</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam odio nec elit accumsan ullamcorper. Aenean sagittis velit eget mi auctor, nec bibendum nunc euismod.</p>
<form action="#" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<br>
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<br>
<label for="message">Message:</label>
<textarea id="message" name="message"></textarea>
<br>
<input type="submit" value="Submit">
</form>
</section>
</main>
<footer>
<p>Copyright ? My Website</p>
</footer>
</body>
</html>
在這個示例中,我們定義了一個基本網頁結構,并添加了一個標題、一個導航欄、三個部分和一個腳注。我們還鏈接了一個外部樣式表文件,并在其中定義了一些基本樣式。
HTML5為網頁設計與開發提供了更多的語義化標簽和功能,使得網頁更加優雅、易于維護和SEO效果更好。