HTML Tags and Elements
HTML (Hypertext Markup Language) is the standard markup language used to create the structure and content of web pages. It consists of a set of tags that define the different elements within a web page.
HTML tags are enclosed in angle brackets (<>
). They usually come in pairs, with an opening tag and a closing tag. The content that goes between the opening and closing tags represents the element's content.
Here are some common HTML tags and elements used for content and formatting:
<h1>
,<h2>
,<h3>
, etc.: Heading tags used to define headings of different levels.<p>
: Paragraph tag used to define paragraphs of text.<ul>
,<li>
: Unordered list and list item tags used to create bullet point lists.<ol>
,<li>
: Ordered list and list item tags used to create numbered lists.<img>
: Image tag used to embed images in a web page.
These are just a few examples of HTML tags and elements. There are many more available for different purposes, such as links, tables, forms, etc.
Let's take a look at an example of a simple HTML structure:
1<!DOCTYPE html>
2<html>
3 <head>
4 <title>My Web Page</title>
5 </head>
6 <body>
7 <header>
8 <h1>Welcome to My Web Page</h1>
9 </header>
10 <main>
11 <article>
12 <h2>About Me</h2>
13 <p>My name is John Doe and I am a software engineer.</p>
14 </article>
15 <article>
16 <h2>My Skills</h2>
17 <ul>
18 <li>HTML</li>
19 <li>CSS</li>
20 <li>JavaScript</li>
21 </ul>
22 </article>
23 </main>
24 <footer>
25 <p>© 2021 My Web Page</p>
26 </footer>
27 </body>
28</html>
In this example, we have a basic HTML structure that includes heading tags (<h1>
, <h2>
), paragraph tags (<p>
), list tags (<ul>
, <li>
), image tag (<img>
), and more. This structure represents a simple web page with content about the author and their skills.
HTML tags and elements play a crucial role in organizing and formatting the content of a web page. By understanding and using these tags effectively, you can create well-structured and visually appealing web pages for your projects.
xxxxxxxxxx
console.log(html);
// Let's define a basic HTML structure
const html = `
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<header>
<h1>Welcome to My Web Page</h1>
</header>
<main>
<article>
<h2>About Me</h2>
<p>My name is John Doe and I am a software engineer.</p>
</article>
<article>
<h2>My Skills</h2>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</article>
</main>
<footer>
<p>© 2021 My Web Page</p>
</footer>
</body>