Repository navigation
Expand file tree
/
Copy pathhtml-guide.txt
More file actions
129 lines (98 loc) · 4.26 KB
/
Copy pathhtml-guide.txt
File metadata and controls
129 lines (98 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
HTML Guide: Building the Structure of Your Webpage
Objective: Create the HTML structure for a modern webpage tutorial. This guide will walk you through creating the basic HTML structure, including a header, main content sections, and a footer.
Create Files
Create index.html for your HTML content.
Create style.css for your CSS styles.
Create script.js for your JavaScript.
Link CSS and JavaScript in HTML
Ensure your HTML file links to your CSS and JavaScript files correctly.
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
Start with the DOCTYPE and HTML Tag
The <!DOCTYPE html> declaration defines this document as HTML5.
The <html> tag is the root element of an HTML page.
<!DOCTYPE html>
<html lang="en">
Head Section
The <head> element contains meta-information about the document.
Include the charset, viewport settings, and link to your CSS file.
html
Copy code
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Modern Webpage</title>
</head>
Body Section
The <body> element contains the content of the HTML document.
Add the header section with a navigation menu.
<body>
<!--Creating a Button to go back to top of web page.-->
<a href="#" id="bToTop">↑Top</a>
<header>
<h1>Modern Webpage Tutorial</h1>
<nav>
<ul>
<li><a href="#html">HTML Basics</a></li>
<li><a href="#css">CSS Basics</a></li>
<li><a href="#js">JavaScript Basics</a></li>
</ul>
</nav>
</header>
Main Content
The <main> element contains the primary content of the document.
Create sections for HTML, CSS, and JavaScript basics.
<main>
<section id="html">
<h2>HTML Basics</h2>
<p>HTML (HyperText Markup Language) is the standard markup language for creating webpages. It describes the structure of a web page.</p>
</section>
<section id="css">
<h2>CSS Basics</h2>
<p>CSS (Cascading Style Sheets) is used to style and layout web pages. It controls the color, font, and spacing of your content.</p>
<section id="colors">
<h2>Color Schemes</h2>
<p>This section demonstrates different ways to set colors in CSS.</p>
<div class="color-example">Example Color Box</div>
</section>
<section id="layout">
<h2>Layout Techniques</h2>
<p>This section shows different layout techniques using Flexbox and Grid.</p>
<div class="flex-container">
<div class="flex-item">Flex Item 1</div>
<div class="flex-item">Flex Item 2</div>
<div class="flex-item">Flex Item 3</div>
</div>
<div class="grid-container">
<div class="grid-item">Grid Item 1</div>
<div class="grid-item">Grid Item 2</div>
<div class="grid-item">Grid Item 3</div>
</div>
</section>
</section>
<section id="js">
<h2>JavaScript Basics</h2>
<p>JavaScript is a programming language that adds interactivity to your website. It can update and change both HTML and CSS.</p>
<button id="jsButton">Click Me!</button>
<section id="dom">
<h2>Working with the DOM</h2>
<p>The DOM (Document Object Model) allows JavaScript to interact with HTML Elements.</p>
<h4 id="domTest">Hi!</h4>
<section id="events">
<h2>Event Listeners</h2>
<p>Events are used to handle interactions in JavaSCript.</p>
<h3>Toggle Event</h3>
<button id="jsToggleBtn">Toggle Mode!</button>
</section>
</section>
</section>
</main>
Footer Section
The <footer> element contains footer information.
<footer>
<p>© 2024 Modern Webpage Tutorial</p>
</footer>
<script src="script.js"></script>
</body>
</html>