html-basic-examples

HTML Basic Examples

In this chapter we will show some basic HTML examples.

Don’t worry if we use tags you have not learned about yet.

HTML Documents

All HTML reports should begin with an archive type declaration: <!DOCTYPE html>.

The HTML record itself starts with <html> and closes with </html>.

The noticeable piece of the HTML record is between <body> and </body>.

Example

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

The <!DOCTYPE> Declaration

The <!DOCTYPE> declaration speaks to the report type, and encourages programs to show pages accurately.

It should just show up once, at the highest point of the page (before any HTML labels).

The <!DOCTYPE> declaration isn’t case touchy.

The <!DOCTYPE> declaration for HTML5 is:

<!DOCTYPE html>

HTML Headings

HTML headings are defined with the <h1> to <h6> tags.

<h1> defines the most important heading. <h6> defines the least important heading:

Example

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>

HTML Paragraphs

HTML paragraphs are defined with the <p> tag:

Example

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

HTML Links

HTML links are defined with the <a> tag:

Example

<a href=”https://www.w3schools.com”>This is a link</a>

The connection’s objective is determined in the href attribute.

Traits are utilized to give extra information about HTML components.

You will become familiar with credits in a later section.

HTML Images

HTML images are defined with the <img> tag.

The source file (src), alternative text (alt), width, and height are provided as attributes:

Example

<img src=”w3schools.jpg” alt=”W3Schools.com” width=”104″ height=”142″>

How to View HTML Source?

Have you ever seen a Web page and wondered “Hey! How did they do that?”

View HTML Source Code:

Right-click in a HTML page and select “View Page Source” (in Chrome) or “View Source” (in Edge), or comparable in different programs. This will open a window containing the HTML source code of the page.

Inspect an HTML Element:

Right-click on a component (or a clear zone), and pick “Review” or “Investigate Element” to perceive what components are comprised of (you will see both the HTML and the CSS). You can likewise alter the HTML or CSS on-the-fly in the Elements or Styles board that opens.