<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
<!DOCTYPE html>
declaration defines that this document is an HTML5 document<html>
element is the root element of an HTML page<head>
element contains meta information about the HTML page<title>
element specifies a title for the HTML page (which is shown in the browser's title bar or in the page's tab)<body>
element defines the document's body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.<h1>
element defines a large heading<p>
element defines a paragraphAn HTML element is defined by a start tag, some content, and an end tag:
<tagname> Content goes here... </tagname>
The HTML element is everything from the start tag to the end tag:
<h1>My First Heading</h1><p>My first paragraph.</p>
Have you ever seen a Web page and wondered "Hey! How did they do that?"
Click CTRL + U in an HTML page, or right-click on the page and select "View Page Source". This will open a new tab containing the HTML source code of the page.
Right-click on an element (or a blank area), and choose "Inspect" to see what elements are made up of (you will see both the HTML and the CSS). You can also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.
A consistent, clean, and tidy HTML code makes it easier for others to read and understand your code.
Here are some guidelines and tips for creating good HTML code.
Always declare the document type as the first line in your document.
The correct document type for HTML is:
<!DOCTYPE html>
HTML allows mixing uppercase and lowercase letters in element names.
However, we recommend using lowercase element names, because:
Good way:
<body>
<p>This is a paragraph.</p>
</body>
Bad way:
<BODY>
<P>This is a paragraph.</P>
</BODY>
In HTML, you do not have to close all elements (for example the <p>
element).
However, we strongly recommend closing all HTML elements, like this:
<section>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</section>
That is all for today :)
Nov 25, 2024, 10:35 AM
Web Maestro